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?
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);
} }`
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?