Example #1
0
        public void StartBridge()
        {
            /* Mandatory - set your AppsFlyer’s Developer key. */
            AppsFlyer.setAppsFlyerKey("aenSuFdSXYGEa8HyMfspZA");
            /* For detailed logging */
            //AppsFlyer.setIsDebug(true);

#if UNITY_IOS
            /* Mandatory - set your apple app ID
             * NOTE: You should enter the number only and not the "ID" prefix */
            AppsFlyer.setAppID("1435121875");
            AppsFlyerTracker.instance.StartTracker();
            AppsFlyer.getConversionData();
            AppsFlyer.trackAppLaunch();
#elif UNITY_ANDROID
            /* Mandatory - set your Android package name */
            AppsFlyer.setCollectIMEI(true);
            AppsFlyer.setCollectAndroidID(true);
            AndroidJavaClass  up = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
            AndroidJavaObject currentActivity = up.GetStatic <AndroidJavaObject>("currentActivity");
            AndroidJavaObject contentResolver = currentActivity.Call <AndroidJavaObject>("getContentResolver");
            AndroidJavaClass  secure          = new AndroidJavaClass("android.provider.Settings$Secure");
            string            android_id      = secure.CallStatic <string>("getString", contentResolver, "android_id");
            AppsFlyer.setAndroidIdData(android_id);
            AppsFlyer.setAppID(Application.identifier);
            AppsFlyerTracker.instance.StartTracker();
            /* For getting the conversion data in Android, you need to add the "AppsFlyerTrackerCallbacks" listener.*/
            AppsFlyer.init("aenSuFdSXYGEa8HyMfspZA", "AppsFlyerTrackerCallbacks");
            //AppsFlyer.init("ePewqH67ho63AZDuhQYtkP");
#else
            AppsFlyer.setCollectIMEI(true);
            AppsFlyer.setCollectAndroidID(true);
            AppsFlyer.setImeiData(SystemInfo.deviceUniqueIdentifier);
            AppsFlyer.setAppID(Application.identifier);
            AppsFlyerTracker.instance.StartTracker();
            AppsFlyer.init("aenSuFdSXYGEa8HyMfspZA", "AppsFlyerTrackerCallbacks");
#endif

            IsInitialized = true;
        }