Are you using the same instance of the registrar to register and unregister?

On Tue, Apr 19, 2016 at 9:48 AM, hh <henry.hertoghe@gmail.com> wrote:
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



--
View this message in context: http://aerogear-users.1116366.n5.nabble.com/Get-the-deviceToken-Android-tp619p621.html
Sent from the aerogear-users mailing list archive at Nabble.com.
_______________________________________________
Aerogear-users mailing list
Aerogear-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/aerogear-users