Is there any way to make notification banners show for an app that is being debugged on Xcode?
Not working for me. When I stop the app on Xcode, notification banners show. If the app is being debugged, notification banners won't show.
When I send a notification, application:didReceiveRemoteNotification: is triggered and the notification is received on the userInfo of this method, but the notification banner never appears.
Yes, my device is configured to show notifications as banners for this app. I have double verified that.
Any thoughts?
thanks.
Banners will appear only when the app is closed/in the background. Otherwise, application:didReceiveRemoteNotification: is called.
Related
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.
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.
Hey can anybody tell how to get custom payload of push notification when app is in background?
If your app is in the background and you receive a push notification and the user taps app "View", the application is launched and application:didFinishLaunchingWithOptions: would get called. In this case we can access custom notification payload via UIApplicationLaunchOptionsRemoteNotificationKey from userInfo dictionary.
If your app is in the background and you receive a push notification and the user taps app icon, it brings the application to the foreground.
When that happens, only applicationDidEnterForeground: is called, and there is no way to access the payload of the push notification.
My requirement is to register for Badge only, no alert so no 'View' button to launch app when user receives notification in background. When user receives notification and application is in background, user taps app icon applicationDidEnterForeground: is called. So we have no way to access launchOptions dictionary or userInfo dictionary from where we can get notification payload.
Am I missing something here?
application:didReceiveRemoteNotification: is called when the user taps on the notification in the statusbar drop down if your app is running in the background. The link you referred to in your answer explains how to use it.
Is there a way to make my background iPhone app to go foreground?
Tnx.
A UILocalNotification will bring the app to the foreground if the device is locked, a notification appears, and the user unlocks the device.
A UILocalNotification with an alertAction will display the alert while the device is unlocked, and if the user taps the View button (or whatever you set it to), your app will be brought to the front.
Not for your app, but the user could do it.
You could schedule a UILocalNotification to inform the user that you are done with your task or whatever.
Nope. But you can do something when you feel must do. For example, use remote Apple Push Notification Service (APNS) to notify your user that you want her to bring your app back to the foreground.
Or, as JustSid put it, use local notification to notify your user that you want her attention.
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.