protected override void Init() { #if UNITY_IOS Core.Debugging.Debugger.Log("WaffleAppsFlyer init", (int)SharedSystems.Systems.APPS_FLYER); AppsFlyer.setAppsFlyerKey(Utils.EmbededCoreConfig.APPSFLYER_DEV_KEY); AppsFlyer.setAppID(Utils.EmbededCoreConfig.APPSFLYER_APP_ID); // For detailed logging AppsFlyer.setIsDebug(true); // For getting the conversion data will be triggered on AppsFlyerTrackerCallbacks.cs file AppsFlyer.getConversionData(); // For testing validate in app purchase (test against Apple's sandbox environment AppsFlyer.setIsSandbox(true); AppsFlyer.trackAppLaunch(); #elif UNITY_ANDROID AppsFlyer.init(Utils.EmbededCoreConfig.APPSFLYER_DEV_KEY); AppsFlyer.setAppID(Utils.EmbededCoreConfig.ANDROID_PACKAGE_NAME); AppsFlyer.setIsDebug(true); //AppsFlyer.createValidateInAppListener ("AppsFlyerTrackerCallbacks", "onInAppBillingSuccess", "onInAppBillingFailure"); #pragma warning disable 618 AppsFlyer.loadConversionData("AppsFlyerTrackerCallbacks", "didReceiveConversionData", "didReceiveConversionDataWithError"); #pragma warning restore 618 #endif }
void appsFlyerInit() { AppsFlyer.setAppsFlyerKey("<DEV_KEY>"); AppsFlyer.setIsDebug(true); AppsFlyer.setAppID("<APP_ID>"); AppsFlyer.setIsSandbox(true); AppsFlyer.getConversionData(); AppsFlyer.trackAppLaunch(); }
/* Note this is for iOS only. Recipt validation on Android has a different API */ void afiosValidate(string prodID, string price, string currency, string transactionID, Dictionary <string, string> extraParams) { Debug.Log("AFVALIDATE called! \n ProductID is: " + prodID + "\n TransactionID is: " + transactionID + "\n Price is: " + price + "\n Currency is: " + currency); AppsFlyer.setIsSandbox(true); AppsFlyer.validateReceipt(prodID, price, currency, transactionID, extraParams); }
public void Initialize() { AppsFlyer.setIsDebug(isDebug); AppsFlyer.setIsSandbox(isSandbox); AppsFlyer.setAppsFlyerKey(devKey); #if UNITY_IOS AppsFlyer.setAppID(iOSAppId); AppsFlyer.trackAppLaunch(); #elif UNITY_ANDROID AppsFlyer.setAppID(androidAppId); AppsFlyer.init(devKey, "AppsFlyerTrackerCallbacks"); #endif AppsFlyer.trackAppLaunch(); }
public void Init(params string[] args) { //Mandatory - set your AppsFlyer’s Developer key. string appflyerKey = args[0]; string appId = args[1]; if (appflyerKey == "" || appId == "") { return; } AppsFlyer.setAppsFlyerKey(appflyerKey); //AppsFlyer.setIsDebug(true); #if UNITY_IOS AppsFlyer.setAppID(appId); AppsFlyer.trackAppLaunch(); #elif UNITY_ANDROID //Mandatory - set your Android package name AppsFlyer.setAppID(appId); AppsFlyer.init(appflyerKey); #endif InitSuccess = true; #if DEVELOPMENT_BUILD AppsFlyer.setIsSandbox(true); #endif #if APPSFLYER_UNINSTALL_EVENT #if USE_FIREBASE_MESSAGING && UNITY_ANDROID if (AFramework.FirebaseService.FirebaseMessaging.FirebaseMessagingToken == null || AFramework.FirebaseService.FirebaseMessaging.FirebaseMessagingToken.Length <= 0) { AFramework.FirebaseService.FirebaseMessaging.EventOnTokenReceived += OnFirebaseMessagingTokenReceived; } else { AppsFlyer.updateServerUninstallToken(AFramework.FirebaseService.FirebaseMessaging.FirebaseMessagingToken); } #elif UNITY_IOS UnityEngine.iOS.NotificationServices.RegisterForNotifications(UnityEngine.iOS.NotificationType.Alert | UnityEngine.iOS.NotificationType.Badge | UnityEngine.iOS.NotificationType.Sound, true); TrackingManager.I.StartCoroutine(CRWaitForNotificationToken()); #endif #endif }
public PurchaseProcessingResult ProcessPurchase(Product e, int skinID = -1) { bool validPurchase = true; // Presume valid for platforms with no R.V. // Unity IAP's validation logic is only included on these platforms. #if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_OSX || UNITY_TVOS // Prepare the validator with the secrets we prepared in the Editor // obfuscation window. var validator = new CrossPlatformValidator(GooglePlayTangle.Data(), AppleTangle.Data(), Application.identifier); try { // On Google Play, result will have a single product Id. // On Apple stores receipts contain multiple products. var result = validator.Validate(e.receipt); Debug.Log("Receipt is valid. Contents:"); foreach (IPurchaseReceipt productReceipt in result) { Debug.Log(productReceipt.productID); Debug.Log(productReceipt.purchaseDate); Debug.Log(productReceipt.transactionID); } } catch (IAPSecurityException) { Debug.Log("Invalid receipt, not unlocking content"); validPurchase = false; } #endif if (validPurchase) { // Unlock the appropriate content here. #if UNITY_ANDROID //(string publicKey, string purchaseData, string signature, string price, string currency Dictionary <string, object> wrapper = (Dictionary <string, object>)MiniJson.JsonDecode(e.receipt); if (wrapper == null) { throw new InvalidReceiptDataException(); } string payload = (string)wrapper["Payload"]; var gpDetails = (Dictionary <string, object>)MiniJson.JsonDecode(payload); string gpJson = (string)gpDetails["json"]; string gpSig = (string)gpDetails["signature"]; AppsFlyer.validateReceipt(googlePublicKey, gpJson, gpSig, e.metadata.localizedPriceString, e.metadata.isoCurrencyCode, new Dictionary <string, string>()); #elif UNITY_IOS if (Debug.isDebugBuild) { AppsFlyer.setIsSandbox(true); } AppsFlyer.validateReceipt(e.definition.id, e.metadata.localizedPriceString, e.metadata.isoCurrencyCode, e.transactionID, new Dictionary <string, string>()); #endif if (skinID != -1) { GameObject.FindObjectOfType <SkinSceneManager>().AddSkinIDToPlayer(skinID); skinID = 0; } else { FindObjectOfType <TitleSceneManager>().AddNoAdsPurchase(); } } return(PurchaseProcessingResult.Complete); }