Why push notification is shown when app is foreground? (iOS10 / iPhone 7)

戏子无情 提交于 2019-11-29 17:51:34

If an application is upgraded to iOS10, and developers of their app have used the UserNotifications framework.Then there are functions by which notification can be displayed as a native banner when app is in foreground.

The UNNotificationPresentationOptions flags allow you to specify UNNotificationPresentationOptionAlert to display an alert using the text provided by the notification.

It effect will same if you are using iOS10 , and app is compatible with UserNotifications framework.

As you mentioned, you have tested the app with Other device with same version, Then might be their app's latest version is not installed on those devices.

It is not based on iPhone7 only. That will work when iOS10 is installed in your device and application is using UserNotifications framework for handling the notification.

Starting with iOS 10 developers can control how notifications are shown when the app is in focus. This is done by setting up a UNUserNotificationCenterDelegate.

The userNotificationCenter:willPresentNotification:withCompletionHandler: will be fired on this delegate where UNNotificationPresentationOptions can be passed to the completionHandler to determine if the notification should be displayed along with its sound and badge value update.

Based on your question it sounds like you are using a SDK or framework to add notifications. You can still use a UNUserNotificationCenterDelegate along with most notification SDKs.

Note that on iOS 9 and older devices this delegate isn't available and notifications will not show in the notification center when they are received while your app is in focus. Instead you must must still use UIApplicationDelegate for older versions of iOS and show an in app message for them.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!