iOS push notification to remove delivered notification - ios

I'm working on a app project that uses react-native and FCM Push Notification (rnfirebase 5.6.x).
I send a notification when the user receives some message and I need to remove that delivered notification if the user reads that message on another source (like our web app).
With the app open or in background, I can send another push with some userInfo to let me know what I need to remove.
Everything is working perfect... Except when the user kill the app. Then I have no control on the received notification...
I tried the use the tag prop on the notification data, but according with firebase, it is for Android only.
Any ideas on how to do that?

Related

iOS any way to modify push notification alert message once received?

My server yields push notifications with a payload including loc-key and loc-args, then when a message is received in the app it displays a notification based on the contents of Localizable.strings filling loc-key template with the content of loc-args.
I'd like to do some post processing for the content of the displayed notification, e.g. access user's address book locally and match a phone number to a contact name, and then display an updated alert while the app is running the background. Is there a way to do that?
You can use a silent push notification (content-available = 1) which will be delivered to application(_:didReceiveRemoteNotification:fetchCompletionHandler:) and then use the information in the push notification to create and display a local notification.
The only drawback with this approach is that your application delegate method won't be called if the user has terminated your app (swipe up from app switcher).
If app is in foreground you can catch and process the notification, but if the app is in background or the app is not running you have no access to the notification data.

Notification - when app is killed

I have implemented AWS SNS push notification service.
We have an issue which is explained below :
Scenario :
We are trying to save the notification message we receive as a part of requirement.
When the app is killed (swipe out from recent apps) we are able to receive notification, also we are able to save the notification message when we open the message directly from the notification panel it works fine,but when we open the app directly the notification message is not getting saved.
In short we are not able to know if we had received a notification message if we directly open the app rather than clicking the message from the notification panel.
Is this default behavior ? or is there any work around for this ?
Have looked into many posts on about Push Notifications but haven't seen any threads pointing to this scenario.
This is a normal behavior, and there is no workaround.
If your app is killed by the user, it won't be able to run ANY code before it's manually launched again.
If it's manually launched from a notification, this notification's payload will be handled by your AppDelegate.
On top of that, don't forget that Push notifications are Best Effort. That means that they are not reliable, they can be heavily delayed or never delivered at all. Don't rely on Push notifications to achieve any critical work.
If you need to keep a copy of your notifications in-app, keep them server side and fetch them as you would do with any other object.
In order to execute code when the app is killed by the user you need to implement VOIP using PushKit framework provided by apple.
VOIP push unlike regular push notification enables the app to become active even if the app is killed by user.

Objective C: Is it possible not to show iOS Push Notifications in specific conditions

Is it possible in iOS 7/8 not to show push notifications? In push userInfo I receive some data. Is it possible to check this data and show/not show this push notification? I need this when user have to logout from my application.
Sorry, You can not stop notification from being shown in notification panel. When your app is in background/terminate state. First Notification is shown in notification panel.
You can control show/hide notification in your application. When your app method didReceiveRemoteNotification is called.
You can ask your back-end developer to send some flag whether this notification should be displayed or not.
Yes,it is possible in server side.when you get notification at the same time ask server side to send save that in one web service from that you have to get and show the details to user.
In app is open that time you able get notification data in didReceiveRemoteNotification.

Callback function for push notifications while app is killed (titanium iOS)

I cant find a clear answer about this in the Titanium documentation. Is it possible to directly respond to a push notification while the app is killed ?
I know that the callback is called when you open the app trough the push notification. but is there a way to respond when the app is opened manually ?
I tried to use remote-notification as UIBackgroundModes, but this only helps for paused apps.
My goal is to show the push notification in a in-app message center.
You should never rely on push notifications to deliver you payloads, they are too limited for that. If the user receives 5 push notifications and opens the app via the app icon, you will never receive any of the payloads. If he opens the app via one of those notifications you will only receive that payload.
You could use silentpush:
http://docs.appcelerator.com/platform/latest/#!/guide/iOS_Background_Services-section-37539664_iOSBackgroundServices-SilentPush
But the app should always query a back-end to get the actual data. That's how WhatsApp does it as well, as you can see when you open it via a notification it will then still fetch the message(s) form the server.

iOS - change a view's content on push notification received event

I'm coming from Android development background. In Android you send a push notification and then you handle the rest using a service (creating the actual system notification, modifying app's content, etc).
As far as I know, when sending iOS push notifications, it automatically creates a system notification for you in the notification center based on your message payload. After searching here and on google, I think I have to use application:didReceiveRemoteNotification event to add/remove a view's content. How can I access the push notification's content so I can put it in the app as well (I want to display the message in the app even if the user has dismissed the notification in the notification center)? There will be another message later on (usually the same day) to remove the message from the app.
I understand that the application:didReceiveRemoteNotification method won't be called if the app is closed, so I will have to use some other event (like didfinishlaunching) to get the message. But how do I access the push notification's message itself?
I want to display the message in the app even if the user has dismissed the notification in the notification center
This can't be done. iOS passes the notification data to your app only if the user opens the app from the notification center. If the user dismisses the notification and later launches the app, the only way for the app to get this data is to retrieve in from your server.
As for getting the notification data if the app is launched from the notification center, see this question.

Resources