I already can manage push notifications from FCM when the app is in Foreground or background, when I do click in notification popup and open app "application didReceiveRemoteNotification" work without problem
My problem is that i don't know how get notification push data if the user open the app normaly (do click in icon app instead of click in notification) and I would lost the data if he close the notification
If the app is in background state UINotification called application didReceiveRemoteNotification , If app is in open state UINotification called application:didFinishLaunchingWithOptions, And can't possible to get data without click on notification in iOS.
check
UIApplicationLaunchOptionsRemoteNotificationKey
or
application:didFinishLaunchingWithOptions
Related
In my ios app i am able to receive push notification on foreground with phonegap-push plugin. but notification handler is called at the time of notification is received not on click of that notification. I want to execute code of redirecting to other page on click of notification when app is in foreground.so is there any way i can check tap or click event on notification in foreground ios app.Any suggestion would be helpful.thank you
I developed an application and used FCM to handle notifications. When the application is in background and a notification received, by clicking on the notification the application:didReceiveRemoteNotification: is called and everything is ok! but if the app is opened with other ways like tapping on the app icon, the application:didReceiveRemoteNotification: function is not called and the notification stays unread.
I know this is how it works but i want whenever there is a notification and no matter how the app opened the application:didReceiveRemoteNotification: called!
My app is receiving a notification and my problem is that when I received one or more notifications in the background and when i click the app icon to bring me in my app foreground then the notification message(s) doesn't able to display in the foreground it will only works if I click the pop up message in notification center not the icon.
You will not get remote push notification data on launch of app after tapping icon. You can only parse push notification body only on tap of notification alert.
So if you want to do any MUST NEED operation for such notifications there is only way is to introduce server in between. So you can use any web service for it and this will be called every time your app launches or comes to foreground. Call that API on background and do the needful you want.
I'm having a little problem in my app : I use to send local notifications to the user when actions are performed in my app, while it's running in background. Notifications are displayed perfectly in the notification center, but there is no pop-up when the notification occurs.
If I'm right, apps running in foreground can't display pop-up on the user screen (only in the notification center) but when the app is running in background, in fact there is pop-up displayed automatically ?
Thanks for your help !
EDIT : In fact, I'm speaking about a notification banner to be displayed too when the notification appear in the notification center.
When your app will go in background then you will see an immediate notification on your phone but you have to tap that notification to trigger didReceiveLocalNotification delegate.
If you receive local notification in foreground then didReceiveLocalNotification will be triggered automatically.
Above scenario is tested and verified.
Update: You must read this documentation: http://www.thekspace.com/home/component/content/article/62-uilocalnotification-demystified.html
I can get the notification by calling didReceiveRemoteNotification , but if the App is running in background and there are 5 notifications, how to get all notifications when App become active?
Unfortunately, there is no way to do this. The data from a notification can only be pushed by clicking the individual notification. More info here: iOS Push Notification - How to get the notification data when you click on the app icon instead of notification