Open contactwahyu opened 5 years ago
Hi, I'm developing Framework7 and having this issue while trying to call getToken() Here is the code:
// Handle Cordova Device Ready Event $$(document).on('deviceready', function() { app.dialog.alert("Loading..."); //console.log("Device is ready!"); var pushtoken; initFCM(); getToken(); });
// Handle Cordova Device Ready Event $$(document).on('deviceready', function() { app.dialog.alert("Loading..."); //console.log("Device is ready!");
var pushtoken; initFCM(); getToken();
});
function initFCM() { console.log("initializing..."); if(typeof(FCMPlugin) != 'undefined') { FCMPlugin.onTokenRefresh(function(token){ pushtoken = token; app.dialog.alert('onTokenRefresh:', token); }, function(err){ app.dialog.alert('error retrieving token: ' + err); }); FCMPlugin.onNotification(function(data){ if(data.wasTapped){ app.dialog.alert(JSON.stringify(data)); }else{ app.dialog.alert(JSON.stringify(data)); } }, function(msg){ app.dialog.alert('onNotification callback successfully registered: ' + msg); }, function(err){ app.dialog.alert('Error registering onNotification callback: ' + err); }); } } function getToken() { if(typeof(FCMPlugin) != 'undefined') { FCMPlugin.getToken(function(token){ pushtoken = token; app.dialog.alert('getToken:', token); if (!token) setTimeout(getToken, 1000); }, function(err){ app.dialog.alert('error retrieving token: ' + err); }); } }
When I call initFCM() I got this message : onNotification callback successfully registered: OK and after that I don't receive any token.
Kindly advise, many thanks before!
same here
Same happened with me, GoogleService-Info.plist was missing, so I added it at the root of my project and every thing started to work..
Hi, I'm developing Framework7 and having this issue while trying to call getToken() Here is the code:
When I call initFCM() I got this message : onNotification callback successfully registered: OK and after that I don't receive any token.
Kindly advise, many thanks before!