Push Notification with a timer - iPhone - 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.

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.

Showing Push notifications

I set my application for push notification and all is running fine. But i want that push notification should also show when my application is running. I do-not want to show an alert or pop in my application
There's nothing built-in to iOS that will make push notification popup appears if the app for the notification is currently in the foreground. You need to look at the data you get in the notification and create a UIAlertView by hand.

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.

Push notification during call - 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.