Can we cancel a push notification from application on iOS5? - ios5

On iOS5, the push notification shows on the top bar and not block user. When the push notification is showing and user click our application but not the push bar, our app will launch normally. However, we want to cancel the push notification at that time. Is it possible ? Thanks a lot!

Short answer: No. There is no way you can manipulate sent notifications as far as I know.

Slightly longer answer:
Once a push request has been sent to the Apple Push Notification servers, thats it. It disappears into their system and they will then try to deliver it on a 'best effort' basis. You receive no feedback about its status or any ability to change/delete it.
The only form of feedback you can get is about which devices do not wish to receive push notifications that you tried to send to.
If you want to send delayed notifications which can be cancelled/modified at later data, either write you own solution, or use some pre-existing solution (e.g Urban Airship).

Related

How to remove a specific push notification from notifications center Swift

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?

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.

iphone push notification to trigger a method

I am not a developer as much as i am a project manager, i need to know more if the following is possible to help me decide the future of a project.
mainly my question is, can i trigger a certain method (function) in my application using the push notification ? so my app might be in the background (or not) and i want to send a push notification message that wakes the application and execute some piece of code.
if the answer is yes, can this be done without the user interaction ? so i mean without the user clicking on the push message ? to be some kind of automated, so i send the Push notification message, the iPhone receives it and execute the code, without the use interaction ?
i can set up my own APNS server if needed.
i am not looking for a code as much as i am looking for an answer if this can be done or not.
Thanks,
Yes, this is possible, as long as the user clicks on the notification. This could be done either with local notifications, or push notifications.
When an application is launched in response to a notification, the AppDelegate method application:didFinishLaunchingWithOptions: will have an option indicating the notification that precipitated the launch.
It cannot, to my knowledge, be achieved without user interaction.

How to tell user about what are recently received push notifications

Is it possible to tell user what were about recently received push notifications ? I mean, if user clicks cancel when push was received, there is a badge on the icon of my application, but that's all. I think this is not user friendly and such notifications have no sense. When user opens an application, he knows that there is something new in it, but don't know exactly what. Do I need to make some requests to my web server to have information about my last pushes or I'm missing something and there is another way ?
From the implementations of push notifications I've worked with so far, you'll need to make a call to your server when the app actually starts up in order for the app to know what the new information is. I don't believe there's any way to store received push notifications unless your app is opened and handling them in the app delegate. Otherwise if push notification is closed it's discarded.
In all the apps I've worked with that utilized push notifications there was a place in the app where all the recent notifications were displayed after a call to the server was made to get the whole list.

Can push notification be sent without an alert for certain actions?

I know you can register to have alerts or not when you call the push notification API. However my problem is that I want a certain class of actions to have an alert notification while no alert notification for other class of action?
So for example, an alert should be shown when we send the notification "Heart rate dropping alert!". But no alert should be shown when we send the notification "downloading updated patient data", the app should just take the notification as an instruction to being download if it is launched. And simply ignore it if it is not launched.
How to implement this?
Check Silent Push Notifications for iOS 7.In the WWDC 2013's "What's New with Multitasking" presentation, there is a section about Silent Push Notifications.
You can embed custom JSON data in the push notification, look at The Notification Payload in the Apple docs.
Update: I don't think that quite answers your question. You can send a blank notification that has the effect of cancelling any previous push notification (including those from other applications). I'm not sure if the app gets notified of that when it is actually running. If it does you might be able to do that in conjunction with a custom JSON payload to achieve what you want?
{"aps": {"badge": 0}}
You probably know this already - you can't use a push notification to launch the app on the iPhone without the user seeing a popup (apps can never run in the background on the iPhone).
However, you can display a different popup message and include different JSON data in the notification. Then if the user presses the button to launch the app ("Start", or whatever you call the button on the right) that JSON data is passed into the app. Your app can then carry out a different action based on that data.
Not possible. Push notifications cannot initiate tasks - nothing can cause an app to execute without user action. Similar question to Can I use Push Notification for this. You can trigger a sound, a text alert, or a badge value. That's it.