fechanique / cordova-plugin-fcm

Google FCM Push Notifications Cordova Plugin
624 stars 990 forks source link

Framework 7 & Cordova-plugin-fcm (iOS) #561

Closed billypap1 closed 5 years ago

billypap1 commented 5 years ago

I have a big problem using framework7 and Cordova-plugin-fcm. Here is my code:

`var app = new Framework7({ root: '#app', theme: 'ios', tapHold: true, pushState: true, domCache: true, swipeout: { noFollow: true, removeElements: false, }, init: false, on: { init: function () { setTimeout(gethetok, 20000);

  function gethetok() {
  FCMPlugin.getToken(function(token) {
    localStorage.fcmtok=token;
    console.log(token);
    if (token===null) {
      console.log('error');
    }
    FCMPlugin.onNotification(function(data) {
        console.log(data);
        if (data.wasTapped) {

           alert(JSON.stringify(data));
      } else {

       alert(JSON.stringify(data));
         }
    });
});

} }`

When I test my app in XCode I can receive the Instance Id from Firebase after some seconds (that's why I have include "setTimeout(gethetok, 20000);" ). I have done all the steps right (include GoogleService-info.plist etc.). I have tested this token via console and I can receive the notification. My problem is that I cannot store via localStorage the value (Instance Id). Am I doing something wrong?