Handle Push Notification when the App is off, or without opening the App at all - iOS

倖福魔咒の 提交于 2019-12-13 08:34:21

问题


I'm building a Push Notification platform with Amazon SNS, using Amazon Cognito and other Amazon AWS tools, so far working flawlessly.

But my App is multi-language, so I'm trying to send just 1 single push message with a dictionary within the payload, this dictionary will contain an array with all the languages that I'm supporting.

So I just don't want to simply handle the message, what I'm intending is to do not show the push message at all before selecting the proper language that should appear to the user... With the App killed or not.

So my Q:

  1. Is this seems possible?

  2. What approach do you suggest to achieve this?

Thank you all very much.


回答1:


  1. No (when the user kills the app or when backgroundfetching is turned off, no notifications will reach your app).

  2. Look into how to localize pushnotifications on apple's developer website. You can acieve exactly what you want by letting the system do the localization. See the applicable keys in the push payload: https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/TheNotificationPayload.html




回答2:


There are some limitations of APNS as follows:

  1. didReceiveRemoteNotifications delegate execute only if the application is in either foreground or background.

  2. If the application is terminated/suspended by either user or OS then notification will be displayed in notification centre but the respective delegate would not get called.

  3. Set both Background fetch and Remote notifications enabled in Background modes from project setting.

  4. Use application:didReceiveRemoteNotification:fetchCompletionHandler: delegate instead of didReceiveRemoteNotifications.

Hope this will help you.



来源:https://stackoverflow.com/questions/35650699/handle-push-notification-when-the-app-is-off-or-without-opening-the-app-at-all

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