How to get push/remote notification when app in foreground in xamarin.ios native app?

sumitmishrasumitmishra Member ✭✭
edited July 2018 in Xamarin.iOS

Hi,
We have implemented APNS push notification in Xamarin.ios native app and its work fine when app in background or kill state.
We have unable to get notification in foreground state. How to solve this?
Can any one suggest how to implement c# code for this

userNotificationCenter:(UNUserNotificationCenter* )center willPresentNotification

Xamarin.ios native app . Please help/guide.

Tagged:

Posts

  • ManojkumarMaliManojkumarMali USMember ✭✭✭

    Hi,

    [Export("application:didReceiveRemoteNotification:fetchCompletionHandler:")] public override void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action<UIBackgroundFetchResult> completionHandler) { if (UIApplication.SharedApplication.ApplicationState.Equals(UIApplicationState.Active)) { BeginInvokeOnMainThread(async () => { UIAlertController okayAlertController = UIAlertController.Create(“Alert Header”, message, UIAlertControllerStyle.Alert); okayAlertController.AddAction(UIAlertAction.Create(“OK”, UIAlertActionStyle.Default, (obj) => { // Your logic })); NavigationController.PresentViewController(okayAlertController, true, null); }); } }

Sign In or Register to comment.