phonegap-build / PushPlugin

This repository is deprecated head to phonegap/phonegap-push-plugin
https://github.com/phonegap/phonegap-plugin-push
MIT License
1.31k stars 996 forks source link

GCM Register ID Refresh Frequency #170

Open manishiitg opened 10 years ago

manishiitg commented 10 years ago

As per your module instructions, we need to call the register() and unregister() function on deviceready and exit; respectively.

but as per google http://developer.android.com/google/gcm/client.html you need to store the register id and update it only when the app version changes.

Even if i write my own logic to save the gcm register id in local storage or app preferences, if we don't call the register() function the ecb notification method is not called. Because this code is written in in register() function only

if ( gCachedExtras != null) { Log.v(TAG, "sending cached extras"); sendExtras(gCachedExtras); gCachedExtras = null; }

shouldn't this be fixed or is it correct to call register(), unregister() so frequently.

AndrewJHart commented 10 years ago

@manishiitg I've been using this plugin on many different apps and for quite some time now; I too have noticed the same thing -- I actually avoid using the unregister() method due to this; It becomes tricky during app updates too and our current workaround isn't very pretty (trying to ensure unregister() is called during first run after update - which has obvious side effects). Apple's feedback service makes this is a non-issue but with GCM I haven't had time to try refactoring the method personally but I believe this is a very valid point that should be considered.

programming-kid commented 10 years ago

yes this should be solved calling register every time app launches is useless and redundant ,this should be fixed, this will save a http call and increase performance

rapofran commented 10 years ago

Maybe this helps https://github.com/phonegap-build/PushPlugin/issues/196