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?
Related
Do I want to know if it's possible to detect when a notification from another application is over my app? For example, when the user receives an SMS or Messenger message. Detect the fact that a notification is present on the screen. I don't want the content of the message.
It's an example, It can be a notification for whatever. Because, when a notification is visible, my player's lost because a part of the UI is under the notification. So, if I know when a notification is visible I can change the layout.
It's not possible to handle notifications from other apps. It would be a huge privacy violation.
I am wanting to implement functionality similar to the Fandango and Starbucks apps where the user gets a notification in an inbox. Ideally, if the user opens the app from the notification, it would go to the appropriate view in the app. For example, if the notification is a benefit update, and the user taps the notification, the benefits view would open.
If the app is opened by tapping the app icon and not by selecting the notification, I want the notification info to be shown in a table view. I'm guessing I could just save the notification payload dictionary to an array and use that to populate the table view. I would also want to badge the inbox in the app and the app icon with the number of notifications in the array.
I'm just not sure how to go about doing this type of functionality.
You can not get the notifications in the notification screen, there is no API for it. Only when a user clicks on a notification is you app informed about the notification used to open your app.
Other apps solve this by keep track of the notifications send to the user on there server and have some API to retrieve these notifications.
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.
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.
I am using push notifications in my app and I would like to send user to particular view, not the view he last saw. Is it possible?
You need to implement the appropriate AppDelegate messages.
Specifically, you will receive the APNS payload on the application:didFinishLaunchingWithOptions:
You might also receive the payload in a different message, application:didReceiveRemoteNotification: if the application is active.
Then when you know that your app was launched because the user touched a notification, you can direct him to a specific view accordingly.
I don't think that you have control over what the user sees while app is starting app (opening animation). After the app is fully active, you can send him wherever you want to by opening proper view controllers, setting proper tab, etc...