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

How to get FCM token in Cordova ? #654

Open
aravindforums1 opened this issue Nov 4, 2022 · 0 comments
Open

How to get FCM token in Cordova ? #654

aravindforums1 opened this issue Nov 4, 2022 · 0 comments

Comments

@aravindforums1
Copy link

Hi,
I try to implement push notification in android mobile app. Using cordova-plugin-firebase-messaging.
i can send push notification to android mobile using firebase console , but what happen those are installed apk file , all are receive the push notifications, but i want to send to specific users, so i want to get FCM token.

What i am tried, in 'index.js' file, i call the below function to get token.

document.addEventListener('deviceready', onDeviceReady, false);
function onDeviceReady() {

FCMPlugin.onTokenRefresh(function(token){
    alert( token );
});

FCMPlugin.getToken(function(token){
    alert(token);
});
}

When i build and install apk file and open in mobile device, but nothing show when open device.

My Cordova version is 11.0.0 and installed plugin is cordova-plugin-fcm-with-dependecy-updated 7.8.0 "Cordova FCM Push Plugin"
Any reply much apricated.

Regards,
Aravind

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

1 participant