You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I call the method window.cordova.plugins.firebase.messaging.getToken() I get null.
And not entirely sure what I'm doing wrong, what I've read I should just call it and get a token.
And when I looked at the Java file and compare it with the older versions I can't really understand what went wrong.
I fixed it by doing like this:
@CordovaMethodprivatevoidgetToken(Stringtype, finalCallbackContextcallbackContext) {
// type can still be null, so if we call type.isEmpty() and is null it will crash.if (type != null && type.isEmpty()) {
callbackContext.sendPluginResult(
newPluginResult(PluginResult.Status.OK, (String)null));
} else {
firebaseMessaging.getToken().addOnCompleteListener(cordova.getActivity(), task -> {
if (task.isSuccessful()) {
callbackContext.success(task.getResult());
} else {
callbackContext.error(task.getException().getMessage());
}
});
}
}
But if there is another solution I wouldn't mind getting a answer. Since I rather just not mess with the source unless I really need to.
The text was updated successfully, but these errors were encountered:
When I call the method
window.cordova.plugins.firebase.messaging.getToken()
I get null.And not entirely sure what I'm doing wrong, what I've read I should just call it and get a token.
And when I looked at the Java file and compare it with the older versions I can't really understand what went wrong.
I fixed it by doing like this:
But if there is another solution I wouldn't mind getting a answer. Since I rather just not mess with the source unless I really need to.
The text was updated successfully, but these errors were encountered: