Skip to content
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

Read gcm data when notification arrived in background/coldstart on Android #2

Open
chemerisuk opened this issue Oct 10, 2016 · 6 comments

Comments

@chemerisuk
Copy link
Owner

No description provided.

@rgfpy
Copy link

rgfpy commented Jul 25, 2017

view this project https://github.com/infobip/mobile-messaging-cordova-plugin/ in this is available functions to read in background arrived, for get some ideas

@h4rm
Copy link

h4rm commented Dec 3, 2018

Any news on this issue?

@AitorAppCoder
Copy link

AitorAppCoder commented Dec 13, 2018

First of all, thank you for all the work done, it's a great plugin.
Well, I just found out too this feature isn't included... and It's a really important one: Having the possibility to do certain expected actions even if the user didn't click the notification.
This should really be implemented. The possibilities left to escape this void are not many, nor good.

Repository owner deleted a comment from sureshchini Jun 29, 2019
@jamesfdickinson
Copy link

jamesfdickinson commented Jul 11, 2019

I thought this was a show stopper, but after further research it was not. This seems to be by design by android. When the app is in the background and the notification is tapped on, the action intent is triggered instead of the onMessageReceived event. The data portion of the payload is preserved but not the notification part. For my purposes all I needed was the data portion in my app. Also if you exclude the notification section, it will not show a notification but will trigger the onMessageReceived while your app is in the background or foreground.

{
"notification": {
"title": "Cribbage JD",
"body": "You have challenged to a game"
},
"data": {
"my_custom_key": "my_custom_value",
"my_custom_key2": true
}
}

@luisVargasGu
Copy link

luisVargasGu commented Apr 21, 2021

I have a similar issue, further explained here

@aravindforums1
Copy link

aravindforums1 commented Nov 13, 2022

 cordova.plugins.firebase.messaging.onBackgroundMessage(function (payload) {
        alert(payload.my_custom_key);
        alert(payload.my_custom_key2);
       });

Use this function to receive payload and get data in mobile device, write this function in ondeviceready function in index.js file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants