问题
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:
Is this seems possible?
What approach do you suggest to achieve this?
Thank you all very much.
回答1:
No (when the user kills the app or when backgroundfetching is turned off, no notifications will reach your app).
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:
didReceiveRemoteNotifications delegate execute only if the application is in either foreground or background.
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.
Set both Background fetch and Remote notifications enabled in Background modes from project setting.
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