我正在开发Xamarin表单应用程序,我启用了推送通知流程,以便将我的应用程序的更新发送给Xamarin iOS平台中的用户。我使用Azure Notification Hub服务将消息发送集成到我的应用程序的已安装用户。我已经按照以下链接中提到的开发和生产程序进行了操作,
https://docs.microsoft.com/en-us/azure/notification-hubs/xamarin-notification-hubs-ios-push-notification-apns-get-started https://developer.xamarin.com/guides/xamarin-forms/cloud-services/push-notifications/azure/
我已经通过测试发送过程发送了通知消息。在最小化或关闭或解锁状态下应用时,通知显示正确。当应用程序处于打开状态时,没有收到任何通知消息和仅显示在其中的警报窗口。对于我的场景,无需显示警报窗口,而不是导航到其中的另一个页面。
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
var pushSettings = UIUserNotificationSettings.GetSettingsForTypes (
UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound,
new NSSet ());
UIApplication.SharedApplication.RegisterUserNotificationSettings(pushSettings);
UIApplication.SharedApplication.RegisterForRemoteNotifications();
return true;
}
public override void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action<UIBackgroundFetchResult> completionHandler)
{
NSDictionary aps = userInfo.ObjectForKey(new NSString("aps")) as NSDictionary;
App.Current.MainPage = new NavigationPage(new SamplePage());
}
我们是否实现了这一点,或者是Azure推送通知流程的这种行为。