Save Push Notifications and Display in UITableView - ios

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.

Related

how to hide close button in iOS notification on apple watch

we're sending critical alerts to the user by remote notification. Users with an apple watch recieve those notifications at their watch display. at the bottom of the notification at the apple watch display, there is a "close" button displayed. If the user hits this close button, the notification seems to be purged by the os and the iphone app has no change to get the notification anymore.
As there is some data transported within the APNS Payload, this data is lost for the app.
We didn't do anything special for apple watch (like a watch app), we only deploy an ios app.
What is the preferred way to
a.) remove the close button in apple watch notification
b.) have the app to be able to access the notification payload if the user hits "close".
Any help appreciated

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 push notification delete

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.

PushNotification in iOs and Application icon is clicked

I receive PushNotification as badge as well as alert and are displayed as badges on the app icon.
I receive the payload successfully when I click on alert, which appears at top area of the screen.
But, if the notification is received and I click on the application icon i don't get the payload in any of below mentioned the methods.
application:didFinishLaunchingWithOptions:
application:didReceiveRemoteNotification:
So, what could be the problem or have I missed something in handling such case.
That would be expected behavior. You don't want to show the push notification for the user if he himself did not actively chose to to tap on the alert. If user is in your app while receiving notification you can ask the user if he wants to view it or dismiss it.

IOS Is there a way to send user to particular view after tapping "view" on notification?

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...

Resources