public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            global::Xamarin.Forms.Forms.Init();

            // Code for starting up the Xamarin Test Cloud Agent
      #if ENABLE_TEST_CLOUD
            Xamarin.Calabash.Start();
      #endif

            LoadApplication(new App());

            // Start Appboy
            Appboy.StartWithApiKey("09aa7156-9aef-4043-acfa-424d0dbc3d80", UIApplication.SharedApplication, options);
            Appboy.SharedInstance.SdkFlavor = ABKSDKFlavor.Xamarin;

            // Subscribe to notification
            NSNotificationCenter.DefaultCenter.AddObserver(ABKFeedController.ABKFeedUpdatedNotification, OnFeedUpdated);

            return(base.FinishedLaunching(app, options));
        }
Esempio n. 2
0
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            // create a new window instance based on the screen size
            Window = new UIWindow(UIScreen.MainScreen.Bounds);

            initialViewController     = Storyboard.InstantiateInitialViewController() as UIViewController;
            Window.RootViewController = initialViewController;

            // make the window visible
            Window.MakeKeyAndVisible();

            // Start Appboy
            Appboy.StartWithApiKey("09aa7156-9aef-4043-acfa-424d0dbc3d80", UIApplication.SharedApplication, options);
            Appboy.SharedInstance.SdkFlavor = ABKSDKFlavor.Xamarin;

            if (UIDevice.CurrentDevice.CheckSystemVersion(10, 0))
            {
                UNUserNotificationCenter.Current.RequestAuthorization(UNAuthorizationOptions.Alert | UNAuthorizationOptions.Badge | UNAuthorizationOptions.Sound, (approved, err) =>
                {
                    Console.WriteLine("Permission granted");
                });

                notificationsDelegate = new UserNotificationsDelegate();
                UNUserNotificationCenter.Current.Delegate = notificationsDelegate;
                UIApplication.SharedApplication.RegisterForRemoteNotifications();
            }
            else
            {
                // Settings for Appboy push
                UIUserNotificationSettings settings = UIUserNotificationSettings.GetSettingsForTypes(UIUserNotificationType.Badge | UIUserNotificationType.Alert | UIUserNotificationType.Sound, null);
                UIApplication.SharedApplication.RegisterForRemoteNotifications();
                UIApplication.SharedApplication.RegisterUserNotificationSettings(settings);
            }

            return(true);
        }