nidIOS
nidIOS

Reputation: 167

Handle Remote Notification in Background

from a couple of days, I am searching solution for this issue, finally posting it here:

when i get Remote Notifications, and ignore the push notification and launch the app by clicking on application icon, delegate method "didreceiveRemoteNotification" will not be called. is there any way to get full Notification payload dictionary, when app launches.

Any Help would be appreciated!

Upvotes: 0

Views: 361

Answers (2)

Rickard Westerlund
Rickard Westerlund

Reputation: 117

At launch you will receive the remote notification through the launch options. In your application delegate, implement - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions and then you can retrieve the same dictionary you would otherwise be given in didReceiveRemoteNotification:(NSDictionary *)userInfo like this:

if ([launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey]) {
    NSDictionary *userInfo = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey]];

    ...
}

Upvotes: 0

Wain
Wain

Reputation: 119021

No.

You should store the notification details on your server and make a request to the server to get pending details (and update details that have been accessed).

The app has no access to notifications in notification centre unless the user explicitly selected to open the app from there.

Upvotes: 3

Related Questions