public override void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action <UIBackgroundFetchResult> completionHandler) { try { var result = Push.DidReceiveRemoteNotification(userInfo); if (result) { completionHandler?.Invoke(UIBackgroundFetchResult.NewData); } else { completionHandler?.Invoke(UIBackgroundFetchResult.NoData); } //NSDictionary aps = userInfo.ObjectForKey(new NSString("aps")) as NSDictionary; //string alert = string.Empty; //if (aps.ContainsKey(new NSString("alert"))) // alert = (aps[new NSString("alert")] as NSString).ToString(); //// Show alert //if (!string.IsNullOrEmpty(alert)) //{ // var notificationAlert = UIAlertController.Create("Notification", alert, UIAlertControllerStyle.Alert); // notificationAlert.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Cancel, null)); // UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewController(notificationAlert, true, null); //} List <int> vs = new List <int>(); App.Current.Properties["BadgeOfNotif"] = ""; } catch (Exception ex) { var log = ex; } }
public override void WillPresentNotification(UNUserNotificationCenter center, UNNotification notification, Action <UNNotificationPresentationOptions> completionHandler) { // Do something, e.g. set a Boolean property to track the foreground state. this.didReceiveNotificationInForeground = true; // This callback overrides the system default behavior, so MSPush callback should be proxied manually. Push.DidReceiveRemoteNotification(notification.Request.Content.UserInfo); // Complete handling the notification. completionHandler(UNNotificationPresentationOptions.None); }
public override void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, System.Action <UIBackgroundFetchResult> completionHandler) { var result = Push.DidReceiveRemoteNotification(userInfo); if (result) { completionHandler?.Invoke(UIBackgroundFetchResult.NewData); } else { completionHandler?.Invoke(UIBackgroundFetchResult.NoData); } }
public override void DidReceiveNotificationResponse(UNUserNotificationCenter center, UNNotificationResponse response, Action completionHandler) { if (response.IsDefaultAction) { // User tapped on notification } // This callback overrides the system default behavior, so MSPush callback should be proxied manually. Push.DidReceiveRemoteNotification(response.Notification.Request.Content.UserInfo); // Complete handling the notification. completionHandler(); }
public override void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, System.Action <UIBackgroundFetchResult> completionHandler) { Analytics.TrackEvent("iOS Received - Remote Notifications"); var result = Push.DidReceiveRemoteNotification(userInfo); if (result) { completionHandler(UIBackgroundFetchResult.NewData); } else { completionHandler(UIBackgroundFetchResult.NoData); } }
public override void WillPresentNotification(UNUserNotificationCenter center, UNNotification notification, Action <UNNotificationPresentationOptions> completionHandler) { var push = notification.Request.Content.UserInfo; var appCenter = push["mobile_center"] as NSDictionary; var presentation = appCenter?["presentation"] as NSString; if (presentation != null && presentation.Equals((NSString)"alert")) { completionHandler(UNNotificationPresentationOptions.Alert); } else { Push.DidReceiveRemoteNotification(push); completionHandler(UNNotificationPresentationOptions.None); } }
public override void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action <UIBackgroundFetchResult> completionHandler) { try { _app.RefreshData(); // TODO: Add implementation here. Push.DidReceiveRemoteNotification(userInfo); completionHandler(UIBackgroundFetchResult.NewData); } catch (Exception) { } }
public override void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, System.Action <UIBackgroundFetchResult> completionHandler) { var result = Push.DidReceiveRemoteNotification(userInfo); if (result) { var container = formsApp.Container; var eventAggregator = container.Resolve <IEventAggregator>(); eventAggregator.GetEvent <Helpers.NewBlogPostEvent>().Publish(); completionHandler?.Invoke(UIBackgroundFetchResult.NewData); } else { completionHandler?.Invoke(UIBackgroundFetchResult.NoData); } }
public override void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, System.Action <UIBackgroundFetchResult> completionHandler) { var result = Push.DidReceiveRemoteNotification(userInfo); if (result) { if (userInfo["aps"] is NSDictionary notification && int.TryParse(notification["badge"]?.ToString(), out int badge)) { _eventAggregator.GetEvent <NotificationReceived>().Publish(badge); completionHandler?.Invoke(UIBackgroundFetchResult.NewData); } } else { completionHandler?.Invoke(UIBackgroundFetchResult.NoData); } }
public override void DidReceiveNotificationResponse(UNUserNotificationCenter center, UNNotificationResponse response, Action completionHandler) { _didTapNotification = response.IsDefaultAction; Push.DidReceiveRemoteNotification(response.Notification.Request.Content.UserInfo); completionHandler(); }