Register for Push of certain events iOS - iphone

I'm trying to write an iPhone app in which the user can register for push-notifications in some events. Lets say the app will display 4 different categories. What if the user only wants notifications from 1 or 2 of these categories?
How can this problem be solved?

when user selects these events you can send a call on server (which is generating the push notification) that only these events should generate the push notification and when sending push notification you can check if this device is registered for this particular event's push notification if the user is not registered for this event then don't send the push notification

Related

Can I delete a push notification from a device which have receive this push notification?

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.

APNS and iOS 5 Notification Center

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.

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

How can I control the Apple Push Notifications I receive

I have successfully created a server that sends Apple Push Notifications, and my iphone receives them.
For example I have Notification of type A and notifications of type B,
How can I control the types of notifications I received on the iphone side? For example I only want type A and not B (Just like Facebook, I want notifications for Friend Request, but not for Walls)
Thanks
you cannot stop your device on receiving a specific type of notification unless it is done on server side. Though you can ignore a notification when app is in running state as you get the notification in didReceiveRemoteNotification and you can simply ignore it after checking it but if app is in background or it is closed then you cannot control the incoming notifications from within your app.
you can make a service on server to set preferences for notification types.
from device, user can enable/disable the push service for individual features and update the preferences on server from device.
On server, before sending the PUSH, you can check for the preferences selected by user from the table and send only those notifications which the user has opted for.

Is is possible for an application to handle the response from a push notification?

Is it possible to get the user's response from a push notification and create a notification reply? i.e. if a user clicks the view button and views the app, can we take that action and let the sender of the notification know that the receiver has viewed / opened the app?
Short answer, Yes.
When the application starts due to a user electing to from a notification (local or remote) the application is started in a special way so that the application can process the notification. At this point it can do whatever you want, like send a message back to your service.
See Handling Local and Remote Notifications for details.