Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple push notifications on 1 device - iPhone

How to handle multiple push notifications on One device e.g:

A user receives a notification saying you have 1 new message from my app. Before he checks that message another message comes in so now he has 2. Well I don't want 2 messages stacked in the notification bar, I want 1 notification saying there are 2 messages waiting. How do I implement this?

And also if on device got 5 new notification and user taps last notification then how we got the previous notification userInfo

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
like image 997
Bhavesh Dhaduk Avatar asked Feb 14 '12 15:02

Bhavesh Dhaduk


People also ask

How do you get multiple notifications on iPhone?

To see your notifications in Notification Center, do any of the following: On the Lock Screen: Swipe up from the middle of the screen. On other screens: Swipe down from the top center. Then you can scroll up to see older notifications, if there are any.

Why do I get 2 notifications on iPhone?

If you have noticed it, you may be already aware of the notification repeat feature on your iPhone. This feature repeats notifications that it deems important once after two minutes.


1 Answers

Regarding your first question, you won't be able to do this. Notifications are seperate events, and NotificationCenter won't (and can't) merge them.

Push notifications aren't meant to deliver (much) information, hence, you cannot rely on reading the userInfo objects. For example, what would you do if the user just closes the notification alert and deletes it without reading it?

What you should do is only use Push notifications to tell your app that "something has happened". The app should then fetch the information from the server. I.e, if the user taps on the last notification, the app will still download all the information linked to all five notifications.

like image 199
JiaYow Avatar answered Oct 21 '22 11:10

JiaYow