Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refreshToken() returns old registration token on Android #149

Closed
kashz opened this issue Jul 21, 2023 · 0 comments · Fixed by #150
Closed

refreshToken() returns old registration token on Android #149

kashz opened this issue Jul 21, 2023 · 0 comments · Fixed by #150

Comments

@kashz
Copy link
Contributor

kashz commented Jul 21, 2023

Describe the bug

refreshToken() returns a registration token before refresh.
This may be because getToken() was called without waiting for it to be deleted.

public void refreshToken(final PluginCall call) {
FirebaseMessaging.getInstance().deleteToken();
FirebaseMessaging.getInstance().getToken().addOnCompleteListener(getActivity(), tokenResult -> {
JSObject data = new JSObject();
data.put("token", tokenResult.getResult());
call.resolve(data);
});
FirebaseMessaging.getInstance().getToken().addOnFailureListener(e -> call.reject("Failed to get FCM registration token", e));
}

Expected behavior
Always return new registration token.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant