I'm using iOS 5 and Push Notifications (with notification bar).
I have received 5 notifications that are available in the notification center. When I tap on any of them, the app launches and I am presented with the payload dictionary in application:didFinishLaunchingWithOptions. After this point, all other notifications related to the app disappear from the notification center.
I want to know if I can achieve any of the following
I can let the unread (untapped) notifications be available in the notification list (for later viewing).
I can get the payload(s) of all unread notifications in application:didFinishLaunchingWithOptions when I tap any one unread notification.
For notifications to remain in Notification Center after your app has been launched from one of them, their payload needs to include a badge number, and your app needs to refrain from setting its badge counter to 0 until it wants to clear all of its notifications from the Notification Center.
There is no way to access the notification payload of APNS messages other than the one your app was launched from. The general best practice if you need that data—particularly considering that APNS delivery is not guaranteed—is to retrieve it separately from your own web service.
Related
my App is an app like Uber app, I sent a task to all my drivers this will be by a push notification.
But when a driver accepts the task first I need to remove the sent push notifications from all drivers devices so it won't be show in the notification center.
I search a lot about this issue, but no answers!
anyone try to delete a specific push notification from the notification center after sent it?
thanks.
You need to send a silent push-notification that triggers a local notification with a specific identifier.
This identifier should be send inside the silent push notification, that also should carry all information the driver should see in the local notification.
you need two types of push-notifications: show, hide.
got the point?
I have the following problem.
I look for a capability to delete a push notification from a device (iPhone respectively Apple Watch) but this device have receive the push notification.
The use case is that a USER A send a request to all available USER Bs. A push notification is send to all these USER Bs. At the moment the push notification arrive it will shown on their Apple Watch. One of the USER Bs answer that he accept this request. After he press the button to accept the request the notification should be deleted on all the other devices.
I really do not know a capability to do this.
But I know that you can handle this problem in Android as provide a unique ID for this notification. After that you can delete the other notifications with this particular ID.
Is their maybe a same way for iOS like it is provided in Android?
This doesn't really have anything to do with WatchKit/Apple Watch.
To answer your main question: no, you can't do this as it describe. Once you fire off a notification, it's in the user's hands to decide what they want to do with it.
As an alternative, you could maintain an "inbox" with every notification in your app and use the notification to prompt the user to check it. That way you could remove a notification from the inbox on the server side of things.
I have an iOS 5 pager application.
Application can receive new message counter from server.
For example application received 5 as a response from server.
So no I need to create new (or update existing) notification in notification center panel
and additionally I need the notification center to receive these notifications while the application is in background.
Help me please. How can it be done?
All of the information you require is in Apple's iOS Developer docs: About Local Notifications and Push Notifications
You also might want to look into the introductory video from WWDC2011: Using local and push notifications on iOS and Mac OS X
When push notification comes, it the user click the app icon instead of clicking the notification to open this app.
Then how can I get the notification payload?
As others have mentioned, you can't.
You can only get the payload when launching from Notification Center because it means the user is interested in that specific notification. If you choose to ignore the notification and open the app by pushing the icon, you won't be able to get the push payload.
They have seemingly designed the architecture in such a way as to prevent the processing of piled up push payloads (say that 10 times).
This is proven because they really only allow you to process a push payload (when the app is closed or in the background) by going through individual notifications. If this wasn't the case, they would have to allow push payload processing code to run for all apps even when they were closed or in the background state.
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
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.