- Your app was just launched
handle callback didFinishLaunchingWithOptions application launched by clicking "View" when app is not running - Your app was just brought from background to foreground
by clicking "View" when app is running in background.
handle callback didReceiveRemoteNotification - Your app was already running in the foreground
handle callback didReceiveRemoteNotification
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
if ( application.applicationState == UIApplicationStateActive )
// app was already in the foreground
else
// app was just brought from background to foreground
...
}
Note: if the app is not foreground, user click "Cancel" when receive notification, there will be NO callback. Only the badge will update.
So the client side should be able to pull data from server. Don't rely on notification sending data to client.
-------- situee.blogspot.com ----------------
Reference:
[1] http://stackoverflow.com/questions/5056689/didreceiveremotenotification-when-in-background
[2] http://stackoverflow.com/questions/14616261/receiving-push-notifications-while-in-background
This comment has been removed by a blog administrator.
ReplyDelete