-
Notifications
You must be signed in to change notification settings - Fork 283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android 13+ app doesn't trigger on('notification') when clicking notification while app is closed or running in background #288
Comments
Same issue here |
Hi, You can try to put in your payload this |
Thanks @ciuffo81, however, I haven't been able to get it to work even after adding the "click_action". I tried different ways of setting the click_action, first trying to add it to the "notification" property/object, but received an invalid JSON payload error. Here's my code showing all the places I've tried to include the "click_action" property, including the commented out places that caused invalid JSON payload errors:
In looking at this https://firebase.google.com/docs/cloud-messaging/concept-options#notifications, it appears that utilizing the "android.notification.click_action" property is the proper way of doing it, but it has a not effect from my tests. I also looked at the issue you linked to and saw someone had a problem with a missing entry in the manifest, but I've verified my manifest file has the following:
Nothing seems to work. |
Have you been able to find a solution? I am having the exact same issue and none of the suggested solutions work for me. |
No, I haven't found a solution yet. |
I'm experiencing the same issue as well. I've made a few different attempts at a fix (including the example above), but I haven't been able to get it to work. @erisu Would you be able to weigh in on this issue? |
Hi everyone, We use the plugin and everything is working fine for us.
Our Tests included the cases
So everything is working as described in the documentation So here are my questions:
|
Turns out my code was missing "click_action": "com.adobe.phonegap.push.background.MESSAGING_EVENT" I got it working with the following payload:
|
@vlads63 thats good news @redbird19 @ElliotNB do you have new insights? what are your buildetails? |
Hi @ksch10bob, thanks for willing to help out. I use Ionic AppFlow to build my app, and the build details are as follows:
I also use the following Environment overides:
My config.xml file uses:
And uses the following preferences:
My server code that sends the notifications uses the following payload:
The server code utilizes CorePush (https://github.com/andrei-m-code/net-core-push-notifications) to make the call to: https://fcm.googleapis.com/v1/projects/{settings.ProjectId}/messages:send, and POST the serialized payload. Everything works great when the app is open on my Android 13 phone. The on('notfication') event is fired, and I can parse the message and redirect the user to the appropriate place in the app based on the arguments in the "data" properties. But if the app is closed or in the background when the notification is received, clicking the notification will open the app but the on('notification') event is NOT triggered. Unfortunately, I only have my personal Android 13 phone I'm testing with, so I can't be sure if this is exclusively a problem with my phone, which is an Android Moto G Play (XT2413V) phone. Edit: I've now also tested with several Android emulated devices via https://appetize.io (Pixel 8, Pixel 7, Galaxy Tab S7) running Android 13 and 14, and all have the same behavior described above (when app is closed or in background, clicking the received notification opens the app but does NOT trigger the on('notification') event). |
FYI, I'm using cordova-plugin-push 4.0.0 and testing with my Android 13 phone.
When the app is closed, or running in background, and a notification is received, clicking the notification will open the app, but not fire the on('notification') event, which prevents the app from automatically redirecting the user to the appropriate location in the app related to the notification. This only seems to affect Android 13+.
FYI, if I have the app open when the notification is received, the app correctly fires the on('notification') event, enabling automatic redirection to the appropriate location.
In iOS, things work perfectly, clicking the notification with the app closed, or running in background, opens the app AND fires the on('notification') event allowing the user to be automatically redirected to the appropriate location in the app.
The text was updated successfully, but these errors were encountered: