notifications - how to get regID using pushwoosh android native SDK -
i using pushwoosh android native sdk push notifications. want reuse regid provided gcm on successful registration. how can regid using android native sdk ?
when regid gcm registration, store in sharedpreferences
access later.
to store it
googlecloudmessaging gcm = googlecloudmessaging.getinstance(getapplicationcontext()); string regid = gcm.register(id); sharedpreferences shp = getapplicationcontext().getsharedpreferences("prefkey", getapplicationcontext().mode_private); shp.edit().putstring("regid",regid).commit();
to it
sharedpreferences shp = getapplicationcontext().getsharedpreferences("prefkey", getapplicationcontext().mode_private); if (shp != null && shp.contains("regid")) regid = shp.getstring("regid", null);
Comments
Post a Comment