easygcm
easygcm copied to clipboard
No token renewal on OS update
When Android is upgraded, Google offers no guarantee the GCM token will keep working, and we saw some cases where GCM would stop working after an upgrade to Android 5.1.
EasyGCM should probably listen to system boot and renew the GCM token if needed:
<uses-permission
android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
...
<receiver android:name=".BootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
Waiting a few seconds for the network to be available, or even better, some exponential backoff, could be a good idea.
This would require adding a new permission (RECEIVE_BOOT_COMPLETED) - which I would like to avoid. I think we could do this as an optional feature of the library - you would specify the permission in your application manifest and the library would then handle it. I will have to think about this. Or maybe if someone can submit a pull request.
@DanielNovak do you have any news about this?
If you want a PR, what would be some code design guidelines you'd have in mind?
@adrien-aubel Sorry - no news yet, but I have it in my backlog. I haven't thought about it in detail yet - so now specific code guidelines :-(. I can't promise an ETA, but I would like to at least start this weekend on this.
Ping @DanielNovak :)
@adrien-aubel do not worry about code guidelines, regular Android style is fine. Just make a PR, that's where we can discuss :-)
This could be fixed in version 1.5.0 as we started using com.google.android.gms.iid.InstanceID
intent filter to renew the registration ID. This should be called also when device information is changed, which is probably also this case. More info here: https://developers.google.com/instance-id/guides/android-implementation
Probably needs testing, before we can close this issue