Hey All,
how can we retrieve the deviceToken in Android? It seems impossible to be done, and I need it to unregister the device (API call needs the deviceToken). Thanks for your help, Kr, Henry |
Hi, deviceToken is not exposed in AeroGear Android lib, anyway you can unregister a device using the unregister[1][2] method. [1] https://github.com/aerogear/aerogear-android-push/blob/master/aerogear-android-push/src/main/java/org/jboss/aerogear/android/unifiedpush/PushRegistrar.java#L40 [2] https://github.com/aerogear/aerogear-android-push/blob/master/aerogear-android-push/src/main/java/org/jboss/aerogear/android/unifiedpush/gcm/AeroGearGCMPushRegistrar.java#L209-L265 On Mon, Apr 18, 2016 at 7:05 PM, hh <[hidden email]> wrote: Hey All, -- -- Passos _______________________________________________ Aerogear-users mailing list [hidden email] https://lists.jboss.org/mailman/listinfo/aerogear-users |
Hi Daniel,
Thanks for your reply. I knew about the "unregister" method but it didn't do his job perfectly, as sometimes it wasn't unregistered and I had the following block & error which where throwed. if ((deviceToken == null) || (deviceToken.trim().equals(""))) { throw new IllegalStateException(DEVICE_ALREADY_UNREGISTERED); } But my device was still registered, so I don't really understand why this error was throwed. Probably, the deviceToken is null, as for the register method, we have the following: if (instanceId == null) { instanceId = instanceIdProvider.get(context); } String token = instanceId.getToken(senderId, GoogleCloudMessaging.INSTANCE_ID_SCOPE); deviceToken = token; while for the unregister method there is nothing, so I don't see how the deviceToken could not be null? Thanks, Henry |
Are you using the same instance of the registrar to register and unregister? On Tue, Apr 19, 2016 at 9:48 AM, hh <[hidden email]> wrote: Hi Daniel, _______________________________________________ Aerogear-users mailing list [hidden email] https://lists.jboss.org/mailman/listinfo/aerogear-users |
Free forum by Nabble | Edit this page |