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

ParsePush token not registered immediately #1071

Closed
Azaratur opened this issue Nov 18, 2020 · 4 comments
Closed

ParsePush token not registered immediately #1071

Azaratur opened this issue Nov 18, 2020 · 4 comments
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@Azaratur
Copy link

Azaratur commented Nov 18, 2020

Documentation says that onNewToken is called upon the first app start, but that's not true.
It's called only when a new token is needed, so if you add ParsePush on an application that already implemented firebase cloud messaging, this method will not be called so ParseFCM.register(token); in ParseFirebaseMessagingService it's not called too.

To fix this we can simply add this on application onCreate:
FirebaseMessaging.getInstance().getToken().addOnCompleteListener(task -> { if (!task.isSuccessful()) { return; } String token = task.getResult(); ParseFCM.register(token); });

Can be this implemented some where in Parse Push library?

@azlekov
Copy link
Contributor

azlekov commented May 13, 2021

Using the new versions of firebase causes runtime issues because of change of their internal classes and library mismatch.

@mtrezza
Copy link
Member

mtrezza commented Oct 9, 2021

@L3K0V is this resolved via #1095?

@mtrezza mtrezza added state:on-hold type:bug Impaired feature or lacking behavior that is likely assumed labels Oct 9, 2021
@azlekov
Copy link
Contributor

azlekov commented Oct 10, 2021

Not yet, maybe I can take this and open PR

@azlekov
Copy link
Contributor

azlekov commented Nov 30, 2021

So,

This is the FCM module issue which now is an optional module. I was thinking to resolve this when Parse initialize but...
Looking at the source of the FCM module and Firebase documentation, everything is implemented as expected. Firebase also mentioned on which cases the token is refreshed and onNewToken is called.

@Azaratur what you did there is a fix for your case and maybe can help others. I also used it before on some of my projects, but I found that for me occurs only when I develop and the way to fix it is to uninstall the app first and clear the data. If you have more general idea to improve the FCM token retrieval feel free to open a PR.

@azlekov azlekov closed this as completed Nov 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

No branches or pull requests

3 participants