コード例 #1
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            window = new UIWindow(UIScreen.MainScreen.Bounds);

            viewController            = new TuneTestViewController();
            window.RootViewController = viewController;
            window.MakeKeyAndVisible();

            Tune.InitTracker(TUNE_ADVERTISER_ID, TUNE_CONVERSION_KEY);
            Tune.AutomateIapEventMeasurement(true);
            Tune.SetFacebookEventLogging(true, false);

            Console.WriteLine("TUNE SDK Started : adv id = {0}, conv key = {1}", TUNE_ADVERTISER_ID, TUNE_CONVERSION_KEY);

            if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
            {
                var pushSettings = UIUserNotificationSettings.GetSettingsForTypes(
                    UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound,
                    new NSSet());

                UIApplication.SharedApplication.RegisterUserNotificationSettings(pushSettings);
                UIApplication.SharedApplication.RegisterForRemoteNotifications();
            }
            else
            {
                UIRemoteNotificationType notificationTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound;
                UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(notificationTypes);
            }

            return(true);
        }