Lets assume a user receives a notification. The user did not respond to notification. what happens? will it automatically get closed? if yes, what is the duration for the expiry of notification on the device? Thanks in advance.
The notification will not automatically get closed, but if another one comes in—be it a text message, a voicemail, or even a notification from another app—then your notification will effectively vanish. If the notification payload includes a badge number for your app, then that will get updated; aside from that, though, once another notification supersedes it, yours is gone.
To your app the behaviour will be the same as if he tapped the close button.
If the user doesn't respond, your app will never know. The push message will remain on the screen until the phone is unlocked or some other message is received (SMS or other push notification)
Related
I'm developing a notification application. User can enter bills with the due date. After that on the due date it'll show a notification. If user press cancel it should not display again.
I used [app cancelLocalNotification:oneEvent]; in the cancel button event. But when it become from background state to foreground that notification still coming. How can I stop this when it comes to foreground after user clicking the cancel button.
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.
So , there is no way you can manipulate sent notifications as far as I know.
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).
I have my Push Notification running. It works. I receive a notification and use
application:didReceiveRemoteNotification:
to get the incoming data and then send the user to the necessary screen.
Problem is, if you are using the App and a notification is received, it jumps to the destination screen without giving any alert/sound/anything.
I could put an alert in application:didReceiveRemoteNotification:, but then that alert would appear every time, not just when the app is running.
Ideas about how to handle this?
I would recommend checking the applicationState property in UIApplication to determine if the app is running in the background or not.
So imagine this scenario:
10.00: your app pushes a message "Hello"
10.01: your app pushes a badge update with no message out the same device
What happens is that the message dissappears. So if the user didn't see it, it's gone. Is there a way to send a badge notification without clearing any previous messages? I know you can send the message again, but I don't want to spam users who may have already ready the message.
I don't want to have a discussion about the why, simply if it's possible?
Unfortunately, it is not possible. We recommend including badge updates with your alerts, to set it at the same time, but there's no way to just update the badge without "overwriting" the alert.
At the same time, however, any message from any other application will also overwrite your earlier alert.
If you include a sound in your APNS payload, the phone will either play the sound or vibrate, so you could at least give the user feedback that a message has been received if you end up needing to do this.
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.