Push notification during call - iPhone - iphone

What happens if I send a push notification to the iPhone and it's during a call, or during incoming call?
would it popup on the screen and show the notification to the user?

Yes, it gets displayed on screen and the user will need to close the notification before they can click the "End Call" button. It's a little distracting, but does ensure that the notification has a chance at being viewed. After all, it might be an important notification.

Related

Notiication when user selects entry from notification center

When a user selects an entry from the push notification center, it triggers the
application:didReceiveRemoteNotification:
method on the application delegate. Is there a way to tell when a push notification is triggered while the user is in the app, and when they select an older push from their notification center?
Is there a way to tell when a push notification is triggered while the user is in the app[...]?
For this I always understood that
application:didReceiveRemoteNotification
is called for every notification received after you start up the app, even if it is on foreground. Although I haven't had the need to do this (and can't confirm it at the moment), so I am calling on theory only. But that's what I can understand from the following on Local and Push Notification Guide.
iOS Note: In iOS, you can determine whether an application is launched as a result of the user tapping the action button or whether the notification was delivered to the already-running application by examining the application state. In the delegate’s implementation of the application:didReceiveRemoteNotification: or application:didReceiveLocalNotification: method, get the value of the applicationState property and evaluate it. If the value is UIApplicationStateInactive, the user tapped the action button; if the value is UIApplicationStateActive, the application was frontmost when it received the notification.
has for
Is there a way to tell when [...](a user) select an older push from their notification center?
For this you could add a order(or time) variable to your push payload to be able to understand if the user is selecting/activating the app trough a push older that a previous one selected.
Check this page for more on adding extra data to the Push Notification.

Push notifications - catching them?

okay, so here is the deal.
my app is using iOS notifications.
in app delegate I am catching them in didReceiveRemoteNotification if the app is in foreground
i catch it in didBecomeActive if app was in background and i tapped on the push notification.
however!
if my app is in background, i receive push notification and if i do not tap on push notifications (or just "Cancel" on it in iOS less than 5.0), and open app in say, couple minutes, i can't figure out how do I find this push notification. any suggestions?
thanks!
If your app is in background the OS handles the push notifications. It sets a badge, shows a text or plays a sound. You even can specify a launch image in iOS5 what the app launches with when "OK" is pressed.
However if you do not press OK or cancel the notification PopUp, there is no chance to catch any information.
If you send your notifications from an application server, you could implement an interface (REST or such) on that server which can be asked for the last notification or even the notification history. But that is a workaround.

iphone: what event will be fired if we close a notofiaction without viewing it

I have a situation say I have to print Notification viewed when local notification is viewed and Notification closed when close button of notification is clicked basically I want to know if we have an event/method which is fired once the notification's cancel button is pressed.
If this is not possible then do we have a method which got fired when the notification is displayed or pushed?
Please shed some light on this.
Your app isn't running, so there is no way to interact with the OS.
The OS will display the localnotification, thus there is no way to either check if the notification is displayed or the cancel button is pressed.

Deferentiating the push notification handler when application is foreground and background

It is said that (correct me if I'm wrong) if the application is in the foreground we have to handle push notifications in the "didReceiveRemoteNotification" and if the application is in the background using "didFinishLaunchingWithOptions" when user taps the "view" button of the app. As I dont have a phone to test I want to know whether I am handling this properly.
1) What will be invoked when I taps on the "View" button in the push notification?
2) Let say I am running the application in the foreground and push notification receives at the same time. Will I be given the push notification alert? If so what will happen if the user click on the View button?
3) In this thread How to handle push notifications if the application is already running? it says:
"alert" key will not be there directly under the userInfo dictionary, you need to get another dictionary with name "aps" and then get the "alert" or "body" from "aps" dictionary"
Is this true?
4) I need to push to a certain view when the user clicks on the View button. Hence do I need to handle that code in both methods?
Thank you
There's a nice rundown of the methods invoked by a push notification in this Apple vid: http://developer.apple.com/videos/iphone/#video-advanced-pushnotification - make sure you visit download the full version in iTunes.
This direct link might work: http://developer.apple.com/itunes/?destination=adc.apple.com.3391495696.03391495702.3416205190?i=1378617410
Either way, the general idea is that if your app isn't in the foreground, tapping your view button will trigger didFinishLaunchingWithOptions, and if it is the foreground app, you'll get the didReceiveRemoteNotification.
I don't think you'll get the alert. The method didReceiveRemoteNotification will be called, and it'll be up to you to show a UIAlert if you want.
Yes - that's true.
Yes, but I think you can simplify this by creating a third method specifically designed to handle your view. You can call this from both didFinishLaunching (only if it launched via a notification), and didReceiveRemoteNotification. This way, if your app needs to be launched, you can have time to do any other setup you might need to do for the app to work right out of the get-go (load saved data, init tabbar controllers or anything else like that).
Best of luck

Push Notification with a timer - iPhone

I would like to send a push notification to the user but I want it to appear only for few seconds and not to stay on the screen. Can I set a timer to close the received notification?
No you can not. The display of push notifications is handled at the system level and unfortunately you don't have any control over them other than to enable or disable them entirely.