Forum Xamarin Xamarin.iOS

Not receiving silent push when app is terminated (Push notification ios)?

DharumaRajDharumaRaj USMember ✭✭
edited January 2017 in Xamarin.iOS

I'm not receiving any silent push notification when my app is terminated or when I swipe the app out from the recent apps list, in fact the didReceiveRemoteNotification method is not called when the app is terminated. I'm new to IOS,I don't know whether it is the intended behaviour.
below is my code :
public override void DidReceiveRemoteNotification(UIApplication application, NSDictionary options, Action<UIBackgroundFetchResult> completionHandler) { SharepointService.LogTrace(Settings.UserName,"Reached DidReceivedRemoteNotification"); if (UIApplication.SharedApplication.ApplicationState == UIApplicationState.Background || (UIApplication.SharedApplication.ApplicationState == UIApplicationState.Inactive && !_isAppStarting)) { SharepointService.LogTrace(Settings.UserName,"Notification Delivered"); ProcessRemoteNotification(options, completionHandler); completionHandler(UIBackgroundFetchResult.NewData); } else if (UIApplication.SharedApplication.ApplicationState == UIApplicationState.Inactive && _isAppStarting) { //Usertapped the notification SharepointService.LogTrace(Settings.UserName, " Tap Notification Delivered"); //ProcessRemoteNotification(options, completionHandler); } else if (UIApplication.SharedApplication.ApplicationState == UIApplicationState.Active) { SharepointService.LogTrace(Settings.UserName,"Active state didreceive remote notification"); ProcessRemoteNotification(options, completionHandler); completionHandler(UIBackgroundFetchResult.NewData); } }
I'm jus logging and processing the remote notification here. I'm also experiencing a strange behaviour,when my app is moved to background and after 10 to 15mins when I ping my app(silent push), I don't receive any message but when my device is connected to a charger and if I ping(silent push), it works . I'm not able to figure out the reason behind this. Thanks in advance


Sign In or Register to comment.