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.
Related
As the title, I just want to receive a VoIP message, then do something.
But it seems to be necessary to do reportNewIncomingCall in didReceiveIncomingPushWith, and it will make the caller scene shows up.
Can I cancel the call before it shows up ?
Can I cancel the call before it shows up?
No.
Generally, any computation from a push notification should inform the user for security purposes. As pushkit wakes up the main app for computation compared to the normal push which wakes only notification extension, it does have more restrictions, for example, callkit UI must be shown to the user.
By default, for any push notification regardless of VOIP or other, it must present a notification to the user. From apple doc, to suppress showing notifications when using pushkit you must have com.apple.developer.user notifications.filtering capabilities.
As a result, hiding notifications and showing callkit with the above-mentioned capability will require extra permission from apple.
However, one way can be a silent push, but that is limited to two or three per hour.
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.
I need to be able to perform some actions when the user unlocks the screen (namely they need to log-in again). I checked the UIApplicationDelegate protocol thinking it was a logical place for such an interface, but didn't see anything that seemed to do this. Is this even possible?
Edit:
applicationDidBecomeActive: and applicationDidEnterBackground: look like they may get triggered for unlocking and locking, but the documentation doesn't mention it specifically.
You can use applicationDidBecomeActive and applicationWillResignActive this will tell you any time the app is slept, this includes locking the phone, and things like phone calls.
applicationDidBecomeActive:
This method is called to let your application know that it moved from the inactive to active state. This can occur because your application was launched by the user or the system. Applications can also return to the active state if the user chooses to ignore an interruption (such as an incoming phone call or SMS message) that sent the application temporarily to the inactive state.
applicationWillResignActive:
This method is called to let your application know that it is about to move from the active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. An application in the inactive state continues to run but does not dispatch incoming events to responders.
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.
Considering that I receive a pushed notification on my iPhone.
What happens:
If the application is started: is there a way to get the payload? Do I see the notification on my screen?
If the application is not started, is there a way to get the payload?
Thx for your answers
First of all push notifications are not “strong”, if you simply let a notification sit for long enough (e.g. phone turned off for many days) it will get discarded. You need to do some custom back-end processing to persist the content sent in notifications.
In the UIApplicationDelegate protocol there’s application:didFinishLaunchingWithOptions:. If your app is launched by the user tapping the right button in an alert of a push notification, the launchOptions dictionary bound to the method call will contain information regarding that notification; if your app is already running then application:didReceiveRemoteNotification: (also in the delegate protocol) will get called instead.
So,
If the application is started, and you implement application:didReceiveRemoteNotification: then yes you get the payload. Otherwise, nothing happens.
If the application is not started at the time the notification is sent, then the user taps on the alert of the notification and launches your app, your app gets the payload if it implements application:didFinishLaunchingWithOptions:. Otherwise, you get nothing.