IOS push notification delete - ios

I use a phone gap plugin and xcode 5.
Lets see the example of the problem:
The application is in background or closed.
I send the notification.
User sees the notification pop up, without clicking on it.
I send another notification.
If user open notification bar it will see two notification actually i want
to delete the previous some how and present to user only the second notification.
The eqvivalent in java is NotificationManage.cancelAll();
For now each/all notification i send are shown when user open notifications bar.
Any help appreciated.

You have (the app has) no control over that.
The user controls how many notifications they see in notification center. Notifications can be removed by the user and will be removed when acted upon (the app is opened from the notification).

You can do this by [UIApplication sharedApplication].applicationIconBadgeNumber = 0;
in the method didReceiveRemoteNotification. In this way notification center will be cleared.

Related

How to prevent an iOS notification being removed from the Notification Center when tapped

Is there a way to prevent a remote notification in the Notification Center from being removed by the OS after it is tapped by the user? The tap invokes the app and didReceiveNotificationResponse() is called. I am not using badges in the notifications.
Apple is not allowing to persist the notification once after you open it.
What’s next
You can create a local notification from data you get from push notification when user taps on it. I have not tried the implementation but it should work in your usecase.
User will not be knowing whether it is local or push notification.

Keeping notifications in panel until user taps them

I've noticed that when a user receives a push notification, if he taps it from the notification panel (or manually launches the app, for that matter), it'll remove the notification from the panel. I suppose this is fine if it's a single notification, but what about if the user has multiple notifications? I wouldn't want it to clear all of them, just the one that was tapped.
I've been having trouble finding out information on this. I know it MUST be possible, because the Skype app does it. You receive 5 push notifications about unread messages on Skype, and if you tap one, it launches the app. However, it doesn't remove all the notifications from the panel, only the one you tapped. How are they doing this?

iOS Display local notifications pop-up while in background

I'm having a little problem in my app : I use to send local notifications to the user when actions are performed in my app, while it's running in background. Notifications are displayed perfectly in the notification center, but there is no pop-up when the notification occurs.
If I'm right, apps running in foreground can't display pop-up on the user screen (only in the notification center) but when the app is running in background, in fact there is pop-up displayed automatically ?
Thanks for your help !
EDIT : In fact, I'm speaking about a notification banner to be displayed too when the notification appear in the notification center.
When your app will go in background then you will see an immediate notification on your phone but you have to tap that notification to trigger didReceiveLocalNotification delegate.
If you receive local notification in foreground then didReceiveLocalNotification will be triggered automatically.
Above scenario is tested and verified.
Update: You must read this documentation: http://www.thekspace.com/home/component/content/article/62-uilocalnotification-demystified.html

Change State when User Selects Notification from iOS Notification Center in Cordova

I'm attempting to open an iOS/Ionic/Cordova app at a specific message/state (given an ID), when a user clicks on a message push notification in the notification center. Is there a way to tell, using Cordova, if the app has been opened through the notification center?
From the docs, the callback is the point of entry for your notification. Any calls you make (or variables you set) inside the callback will only be possible if the app has been opened through the notification center

Stack one push notification in notification center

In case the user is busy and didn't check his notifications in the notification centre. I don't want my notifications to get stacked. that may lead to removing the app. by user.
Therefore, when a notification receive I want to clear all previous notifications my app. sent and keep only the new one.
Is that possible?
Note: I want to remove them before they got clicked. If one got
clicked I can remove them easily in didReceiveRemoteNotification.

Resources