开发者

What happens when my app receives multiple push notifications?

I have a doubt in APNs. What would happen if an application receives more than 1 notification when it is not currently running. Whether the OS will show the alerts one by one [If user keeps on closing the alerts] or it will lauch the app if any "view" action is clicked by the user, If so what about the rest of the alerts ? If the application is launched , will it provide the notification object that lauches the app or we can able to access all the notification alerts that are in the queue.

Help me开发者_开发问答 out what will be the process if an app(not running) receives more than 1 notification ? with possible options ("View"/"Close")


  1. If the alerts are received at the same time interval with few milliseconds delay on the device, it will notify multiple alerts by its sound and even you can see the pop-up of all those alerts one by one and vanishing but the one that is received last or latest will be only displayed to you to either view the application or close.

  2. If the application is running or is started by clicking on the view button on alert then to get rest of the alerts to be viewed you have to handle it in the device itself. The OS will by default simply ignore all those alerts came when application is running. You have to check whether alert is received when the application is running.

This can be achieved using UIApplication delegate method:

(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo 

this you need to implement. This receives the notification when the app is running.

Once you implement the above method you will get pop on each alert even if application is running. And in this case it wont launch a new instance of application. It will just show you the pop up alert. Even if you click on view, it wont to anything. If you want any particular job to be done after clicking on view when application is running you can make this new functionality and tell OS to behave as you need.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜