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

Should onTokenRefresh() be included? #11

Closed
ACCTFORGH opened this issue Nov 30, 2015 · 4 comments
Closed

Should onTokenRefresh() be included? #11

ACCTFORGH opened this issue Nov 30, 2015 · 4 comments

Comments

@ACCTFORGH
Copy link

As mentioned in the GCM doc, onTokenRefresh() should be invoked if registration token changed. Currently this method is not included in the package. Should this method be implemented? or the registration token stays same unless manually changed so this method is optional.

GCM doc link: https://developers.google.com/cloud-messaging/android/client?configured=true

Thanks.

@ACCTFORGH ACCTFORGH changed the title Should onTokenRefresh be included Should onTokenRefresh() be included? Nov 30, 2015
@oney
Copy link
Owner

oney commented Nov 30, 2015

I will recommend doing requestPermissions every time when app starts, and check whether the token changes by yourself.

@ACCTFORGH
Copy link
Author

Thanks! So the token won't change unless the app is terminated?

Also, one thing I am curious, I first put the requestPermissions() method after the addListeners method as in the instructions but did not get the "register" event captured and didn't see the received token printed in console. However, putting the method before the listeners works. Shouldn't the listeners be lasting and the sequence of requestPermissions() not affect the event being caught by the listeners?

@oney
Copy link
Owner

oney commented Nov 30, 2015

Hmm.. Token refreshing should be handled better. I will implement it in the future and welcome a PR!

I think the sequence of requestPermissions and listener matters.
I can't figure out why putting requestPermissions() method after the addListeners doesn't work...

@ACCTFORGH
Copy link
Author

Now, putting the method after the listeners works too. It could be just that it took some time for the app to first time register.

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

No branches or pull requests

2 participants