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 void OnFirebaseMessagingTokenReceived(Firebase.Messaging.TokenReceivedEventArgs token) { AppsFlyer.updateServerUninstallToken(token.Token); }