angularcordovaionic-frameworkcordova-plugin-fcmionic-v1

How to use FCM in ionic v1


I am new in ionic, I want to know how to use FCM in ionic v1 project Please help me. I am using Cordova-plugin-fcm. At first, i am installing this plugin in my project using this comment "ionic Cordova plugin add Cordova-plugin-fcm"

FCMPlugin.getToken(
function (token) {
    alert('Token: ' + token);
    console.log('Token: ' + token);
},
function (err) {
    alert('error retrieving token: ' + token);
    console.log('error retrieving token: ' + err);
}

);

then using this code in my app.js, $ionicPlatform.ready()

now the error is showing my browser console

FCMPlugin is not defined

please help me


Solution

  • Remove your plugin which you added and install these plugins by writing following command:

    1. ionic plugin add cordova-plugin-fcm.
    2. ionic plugin add cordova-plugin-inappbrowser.

    Note: Try removing your platforms and hooks if your problem persist and install the above plugin again.