In my app, i need to set alarm when the user receives a push notification.And it should stop when the user reads the notification. How to achieve it?
You can use Notification Extension to trigger an alarm.But you cannot have to repeatedly alert between the user reads the notification.It is possible you can notify sound for 30seconds.
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.
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)
I want to send a notification to the user of my iOS application, preferably using NSLocalNotificaiton.
However, if the user is on a call I don't want them to recieve the notification until after the call (I don't want to interrupt their call). Is there any way to schedule the notification to occur after the call has ended?
A notification will no more interrupt a call than a calendar or SMS alert does—the alert view will appear on their screen, and if the ringer isn't silenced then the alert sound will play, but the user won't get disconnected or anything in the process. The only way you have of detecting that the user may have finished a call is the -applicationDidBecomeActive: method on your app delegate, but if your app's going to be in the foreground (which is the only point at which it'll receive that message) then you don't need to bother with a UILocalNotification. In short: no, you can't schedule things around the user's phone activity, but nor should you worry about your notifications interrupting them mid-call.
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.
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.