[Aerogear-users] Get the deviceToken - Android

Summers Pittman supittma at redhat.com
Tue Apr 19 12:31:31 EDT 2016


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 at 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 at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/aerogear-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/aerogear-users/attachments/20160419/de004dc1/attachment.html 


More information about the Aerogear-users mailing list