//With completion handler...this is background mode public override void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action <UIBackgroundFetchResult> completionHandler) { Console.WriteLine("RECEIVED_NOTIFICATION_WITH_COMPLETION ::{0} ", userInfo); ALPushNotificationService pushNotificationService = new ALPushNotificationService(); pushNotificationService.NotificationArrivedToApplication(application, userInfo); completionHandler(UIBackgroundFetchResult.NewData); //base.DidReceiveRemoteNotification(application, userInfo, completionHandler); }
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { // Override point for customization after application launch. // If not required for your application you can safely delete this method if (ALUserDefaultsHandler.IsLoggedIn) { ALPushNotificationService.UserSync(); // Get login screen from storyboard and present it UIStoryboard Storyboard = UIStoryboard.FromName("Main", null); MainViewController MainViewController = Storyboard.InstantiateViewController("MainViewController") as MainViewController; this.Window.MakeKeyAndVisible(); this.Window.RootViewController.PresentViewController(MainViewController, true, () => { }); } ALAppLocalNotifications localNotification = ALAppLocalNotifications.AppLocalNotificationHandler; localNotification.DataConnectionNotificationHandler(); if (launchOptions != null) { NSDictionary dictionary = (Foundation.NSDictionary)launchOptions.ObjectForKey(UIApplication.LaunchOptionsRemoteNotificationKey); if (dictionary != null) { Console.WriteLine(@"Launched from push notification: {0} ", dictionary); ALPushNotificationService pushNotificationService = new ALPushNotificationService(); Boolean applozicProcessed = pushNotificationService.ProcessPushNotification(dictionary, 0); if (!applozicProcessed) { //Note: notification for app } } } ALChatManager.registerNotification(); return(true); }