Example #1
0
		public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
		{
			var notificationSettings = UIUserNotificationSettings.GetSettingsForTypes (UIUserNotificationType.Alert, null);
			application.RegisterUserNotificationSettings (notificationSettings);
			application.RegisterForRemoteNotifications ();

			return true;
		}
		public override bool FinishedLaunching (UIApplication app, NSDictionary options)
		{
			#if DEBUG
			Xamarin.Calabash.Start();
			#endif


			// create our window
			window = new UIWindow (UIScreen.MainScreen.Bounds);
			window.MakeKeyAndVisible ();

			home = new Screens.iPhone.Home.Home_iPhone();
			home.View.Frame = new CoreGraphics.CGRect (0, UIApplication.SharedApplication.StatusBarFrame.Height, UIScreen.MainScreen.ApplicationFrame.Width, UIScreen.MainScreen.ApplicationFrame.Height);
			window.RootViewController = home;

			// check for a notification
			if(options != null) {

				// check for a local notification
				if(options.ContainsKey(UIApplication.LaunchOptionsLocalNotificationKey)) {

					UILocalNotification localNotification = options[UIApplication.LaunchOptionsLocalNotificationKey] as UILocalNotification;
					if(localNotification != null) {

						new UIAlertView(localNotification.AlertAction, localNotification.AlertBody, null, "OK", null).Show();
						// reset our badge
						UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0;
					}
				}

				// check for a remote notification
				if(options.ContainsKey(UIApplication.LaunchOptionsRemoteNotificationKey)) {

					NSDictionary remoteNotification = options[UIApplication.LaunchOptionsRemoteNotificationKey] as NSDictionary;
					if(remoteNotification != null) {
						//new UIAlertView(remoteNotification.AlertAction, remoteNotification.AlertBody, null, "OK", null).Show();
					}
				}
			}

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

				app.RegisterUserNotificationSettings (notificationSettings);
				app.RegisterForRemoteNotifications ();
			} else {
				//==== register for remote notifications and get the device token
				// set what kind of notification types we want
				UIRemoteNotificationType notificationTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge;
				// register for remote notifications
				UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(notificationTypes);
			}

			return true;
		}
Example #3
0
		public override bool FinishedLaunching (UIApplication app, NSDictionary options)
		{
			// Override point for customization after application launch.
			UIUserNotificationSettings notificationSettings = UIUserNotificationSettings.GetSettingsForTypes (UIUserNotificationType.Alert, null);
			app.RegisterUserNotificationSettings (notificationSettings);;
			app.RegisterForRemoteNotifications ();

			return true;
		}
        //
        // 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)
        {
            global::Xamarin.Forms.Forms.Init();
            LoadApplication(new SNSPushNotification.App());

            app.RegisterForRemoteNotifications();

            return base.FinishedLaunching(app, options);
        }
Example #5
0
		public override void DidRegisterUserNotificationSettings (UIApplication application, UIUserNotificationSettings notificationSettings)
		{
			application.RegisterForRemoteNotifications();
		}
 public void DidRegisterUserNotificationSettings(UIApplication application, UIUserNotificationSettings notificationSettings)
 {
     //application.RegisteredForRemoteNotifications (application);
     application.RegisterForRemoteNotifications ();
 }
		public override void DidRegisterUserNotificationSettings (UIApplication application, UIUserNotificationSettings notificationSettings)
		{ 
			//application.RegisteredForRemoteNotifications (application);
			SystemLogger.Log (SystemLogger.Module.PLATFORM, "DidRegisterUserNotificationSettings from AppDelegate..."); 
			application.RegisterForRemoteNotifications (); 
		}