Get the custom push notification payload when the app is running in the background

Hey can anyone tell me how to get a custom push notification payload when the app is in the background?

If your application is in the background and you receive a push notification, and the user’s “Short press” application is launched, and application:didFinishLaunchingWithOptions: will be called. In this case, we can access the user payload through the UIApplicationLaunchOptionsRemoteNotificationKey from the userInfo dictionary.

If your application is in the background and you receive a push notification and a user’s application icon, it brings the application to the forefront.

When this happens, only applicationDidEnterForeground: is called, and there is no way to access the push notification payload.

My requirement is to register only for the icon, without warning, so the "View" button does not start when the user receives a notification in the background. When the user receives a notification and the application is in the background, the t23 application's taps application icon is called up. Thus, we do not have access to the launchOptions dictionary or userInfo dictionary, from where we can get the notification payload.

Did I miss something?

+4
source share
2 answers

application:didReceiveRemoteNotification: called when the user deletes a notification in the status bar if the application is running in the background. The link you referenced in your answer explains how to use it.

Edit: Sorry, I misunderstood your question (missed that you only do the icon). Feel free to vote me: (

+7
source

Finally, I found out that receiving user-friendly push notification information when starting the application is not possible. This link sums up.

+2
source

All Articles