11using Foundation ;
22using UIKit ;
3- using AppsFlyerXamarinBinding ;
43using System ;
4+ using AppsFlyerXamarinBinding ;
55
66namespace AppsFlyerSampleApp
77{
8- // The UIApplicationDelegate for the application. This class is responsible for launching the
9- // User Interface of the application, as well as listening (and optionally responding) to application events from iOS.
8+ // The UIApplicationDelegate for the application. This class is responsible for launching the
9+ // User Interface of the application, as well as listening (and optionally responding) to application events from iOS.
1010
11- [ Register ( "AppDelegate" ) ]
11+ [ Register ( "AppDelegate" ) ]
1212 public class AppDelegate : UIApplicationDelegate
1313 {
1414 // class-level declarations
15- AppsFlyerTracker tracker = AppsFlyerTracker . SharedTracker ( ) ;
16-
15+ AppsFlyerLib appsflyer = AppsFlyerLib . Shared ;
1716 public override UIWindow Window {
1817 get ;
1918 set ;
@@ -23,19 +22,24 @@ public override bool FinishedLaunching (UIApplication application, NSDictionary
2322 {
2423 // Override point for customization after application launch.
2524 // If not required for your application you can safely delete this method
26- tracker . IsDebug = true ;
27- tracker . AppsFlyerDevKey = "4UGrDF4vFvPLbHq5bXtCza" ; // Replace with your DevKey
28- tracker . AppleAppID = "753258300" ; // Replace with your app ID
29- tracker . setAppInviteOneLink ( "E2bM" ) ; // Replace with your OneLink ID
25+ appsflyer . IsDebug = true ;
26+ appsflyer . AppsFlyerDevKey = "4UGrDF4vFvPLbHq5bXtCza" ; // Replace with your DevKey
27+ appsflyer . AppleAppID = "753258300" ; // Replace with your app ID
28+ appsflyer . AppInviteOneLinkID = "E2bM" ; // Replace with your OneLink ID
29+ appsflyer . AnonymizeUser = true ;
30+ if ( UIDevice . CurrentDevice . CheckSystemVersion ( 14 , 0 ) ) {
31+ appsflyer . WaitForAdvertisingIdentifierWithTimeoutInterval ( 10 ) ; // When Xamarin.iOS will support AppTrackingTransparency, you should implement a popup asking for IDFA permission
32+ // Ask for the IDFA permission here (with AppTrackingTransparency framework)
33+ }
3034 string [ ] networks = { "test_int" , "partner_int" } ;
31- tracker . SharingFilter = networks ;
35+ appsflyer . SharingFilter = networks ;
3236
3337
3438
3539 // Conversion data callbacks
3640 ViewController controller = ( ViewController ) Window . RootViewController ;
37- AppsFlyerTrackerDelegate af_delegate = new AppsFlyerConversionDataDelegate ( controller ) ;
38- AppsFlyerTracker . SharedTracker ( ) . Delegate = af_delegate ;
41+ AppsFlyerLibDelegate af_delegate = new AppsFlyerConversionDataDelegate ( controller ) ;
42+ AppsFlyerLib . Shared . Delegate = af_delegate ;
3943
4044 // Uninstall Measurement
4145 var settings = UIUserNotificationSettings . GetSettingsForTypes (
@@ -74,7 +78,7 @@ public override void OnActivated (UIApplication application)
7478 {
7579 // Restart any tasks that were paused (or not yet started) while the application was inactive.
7680 // If the application was previously in the background, optionally refresh the user interface.
77- tracker . TrackAppLaunch ( ) ;
81+ appsflyer . Start ( ) ;
7882
7983 }
8084
@@ -92,21 +96,21 @@ public override void FailedToRegisterForRemoteNotifications (UIApplication appli
9296 [ Export ( "application:didRegisterForRemoteNotificationsWithDeviceToken:" ) ]
9397 public override void RegisteredForRemoteNotifications ( UIApplication application , NSData deviceToken )
9498 {
95- tracker . RegisterUninstall ( deviceToken ) ;
99+ appsflyer . RegisterUninstall ( deviceToken ) ;
96100 }
97101
98102 [ Export ( "application:openURL:options:" ) ]
99103 public override bool OpenUrl ( UIApplication app , NSUrl url , NSDictionary options )
100104 {
101- tracker . handleOpenUrl ( url , options ) ;
105+ appsflyer . handleOpenUrl ( url , options ) ;
102106 return true ;
103107 }
104108 //Universal Links
105109 public override bool ContinueUserActivity ( UIApplication application ,
106110 NSUserActivity userActivity ,
107111 UIApplicationRestorationHandler completionHandler )
108112 {
109- AppsFlyerTracker . SharedTracker ( ) . ContinueUserActivity ( userActivity , completionHandler ) ;
113+ AppsFlyerLib . Shared . ContinueUserActivity ( userActivity , completionHandler ) ;
110114 return true ;
111115 }
112116 }
0 commit comments