Push notifications when user force quits the app - push-notification

I have implemented onesignal in my iOS app as per the setup instructions given here (https://documentation.onesignal.com/docs/ios-sdk-setup).
When I install the app for the first time, I get notification from Onesignal dashboard.
When I kill the app, I still seem to get the notification.
But when I launch the app again, I stopped receiving any notification until I uninstall and install the app again.
So am I missing anything here? Do we receive push notification even if app is killed by the user?

You can receive push notifications on your app whether it is active, in background or killed using the NotificationServiceExtension.
The OneSignal documentation shows how to do this:
https://documentation.onesignal.com/docs/silent-notifications
Relevant Apple Docs:
https://developer.apple.com/documentation/usernotifications/unnotificationserviceextension

Related

How to send a push notification to pwa from a nodejs server?

I have a working PWA application and i have tried integrating push notifications to it which worked. But those notifications happened totally in the front end, a user has to click a button and a push notifications would show up.
In my application i have a cronjob that runs every night to check if certain things are updated. If so i want to send a push notification to a user to notify them.
But i cannot find any information regarding this subject so I'm thinking it's not possible since the nodejs server doesn't have a connection to the PWA. Is there something I'm overlooking on my approach or is it simply not possible?

Send push notifications on app install in Flutter

Is it possible to send push notifications on app install in Flutter?
By app install, I mean that a user who has just downloaded the app but not opened it yet.
I'm using flutter_local_notifications to handle notifications on the foreground and firebase handles background notifications.
But both don't seem to help with app install case.
It's impossible task:
There are a few preconditions which must be met before the application can receive message payloads via FCM:
The application must have opened at least once (to allow for
registration with FCM)
.
(c) Firebase Cloud Messaging

Should all Firebase notifications open at the same time for iOS Flutter app?

I have implemented Firebase Messaging into my Flutter app. Everything is working fine for Android. On iOS, if I received 2 or more push notifications, when I open one of those push notifications or bring the app to the foreground, onResume is triggered for all of the notifications at the same time and all of the notification are removed from my lock screen. I would expect onResume to only get called for the selected notification and onResume not getting called at all if the app is opened or brought to the foreground without interacting with the notification banner. That is how it's working for Android.
Is this the expected behavior or is there a way around this?
UPDATE
I removed content_available: true from my payload and that stopped onResumed from getting called multiple times when the app is launched/resumed, but the unopened notifications are still disappearing.

Flutter FCM Push Notification Not Working when app is in foreground

I am sending push notifications using Flutter's firebase_messaging package and I send them in the firebase console. When the app is in the background or when it is closed, I am receiving the notifications, however, when the app is in the foreground it is not working. Please tell me if I need to integrate Javascript to make this feature work, and please reference a resource that I can use in order to figure out how I can integrate Javascript with fcm as I haven't found a way to do this with flutter.
I figured out that someone can use the flutter local notifications plugin so that when the push notification is sent and the app is on the foreground, normally no notification would be delivered to the system tray, but using the flutter local notifications plugin, it would be possible to send a local notification when the app is on the foreground.
To Understand better.
Have a look into this table.
https://pub.dev/packages/firebase_messaging#receiving-messages
It states that when your Android or iOS Application is in foreground, OnMessage callback is called if you are sending notification payload or data payload as notification body.
You are receiving notifications when your app is in background because, when an app is in background notification is send to system tray and OS (Android or iOS) handle it for you. And your app is launched when you click on notification from system tray.
When your app is in foreground you have to catch notification payload in onMessage and handle it explicitly, you can create local notification in this case.

Push notification to iOS not working when message received

I have a Worklight app doing push notifications. Sending the push causes the notification to appear in the notification bar on both Android and iOS as expected. If the push is received while the app is running, it calls the message handler function as it is supposed to.
The issue I'm having is that if you launch the app by tapping on the notification on iOS, the message handler never gets called if another push is sent while the app is running. I have to exit the app and kill it completely, then relaunch the app from the launcher. Then if the push is received while the app is running, it will call the message handler.
This only occurs on iOS. The app will respond to a received message on Android while the app is running, even if the app has been launched by tapping on the notification.
EDIT:
I did struggle to verbalize the scenario, couldn't find the right words that made sense, but the steps you have done Idan are largely correct for what I'm trying to do. We are doing tag based notifications, so that is different that what you have done. We are also using PersistentCookieAuthentication as they wanted push notifications to be sent without the user having to explicitly logging in.
We are currently using WL build 6.2.0.01-20141216-0427
We've tried it on a couple of different models, an iPhone 4s running 8.0.2, and an iPhone 5 running 8.1.2.
Edit based on the edited question:
Tag-based notifications do not require any login, as it is the device that is to be subscribed to any tags that you define in application-descriptor.xml; it is not login-based, so any type of login that you are doing it irrelevant. The push will be sent to any device (app...) that was subscribed to your tag using the subscribeTag API.
I did another test in iOS using a broadcast-based notification (it's basically like tag-based notifications). I kept the app in the background and sent a notification. Tapping on the incoming notification in the notification bar brought the app to the foreground, which then displayed the alerts of the incoming notification.
You can try it with this application: https://www.dropbox.com/s/l2yk2pbvykrzfoh/broadcastNotificationsTest.zip?dl=0
Make sure to place your own .p12 certificate and pushSender password.
I've been trying to understand your scenario... I suspect you've left out something or need to better word the problem description.
Here's what I've tried using MobileFirst Platform 6.3 (no drastic push changes in iOS between 6.2 and 6.3) and iPhone 6 running iOS 8.1.2.
Launched sample push notifications app (which uses event source-based notifications) on device
Logged-in > Subscribed
Quit application
I then sent a notification by invoking the adapter in the Studio
The notification arrived and displayed in the notification bar
Tapping the notification launched application
Logged-in
The notification alerts were then displayed.
I then moved the application to the background.
Sent another notification, which was displayed in the notification bar upon arrival
Tapping this second notification brought the application to the background, displaying the alerts
I then kept the application in the background.
Sent a third notification
In this case, because the application is in the foreground, the notification did not display in the notification bar -- as expected -- and instead the alerts were displayed right away.
If your scenario is different than the above, such as: you're not even using event source-based notifications but rather broadcast- or tag-based notifications, or your application flow differs, etc then please edit the question with a more precise description.
When you edit the question, also mention the following:
Worklight version and build number
Device model
Used iOS version
I am aware of one possible issue (APAR #PI31988) that is currently under investigation, where the underlying native code dispatches the message before the JavaScript framework is ready to handle it, thus no message is displayed. This was found to happen in slower devices such as iPhone 4.

Resources