<div dir="ltr">Are you using the same instance of the registrar to register and unregister?</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 19, 2016 at 9:48 AM, hh <span dir="ltr"><<a href="mailto:henry.hertoghe@gmail.com" target="_blank">henry.hertoghe@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Daniel,<br>
<br>
Thanks for your reply.<br>
<br>
I knew about the "unregister" method but it didn't do his job perfectly, as<br>
sometimes it wasn't unregistered and I had the following block & error which<br>
where throwed.<br>
<br>
if ((deviceToken == null) || (deviceToken.trim().equals(""))) {<br>
throw new<br>
IllegalStateException(DEVICE_ALREADY_UNREGISTERED);<br>
}<br>
<br>
But my device was still registered, so I don't really understand why this<br>
error was throwed.<br>
<br>
Probably, the deviceToken is null, as for the register method, we have the<br>
following:<br>
<br>
if (instanceId == null) {<br>
instanceId = instanceIdProvider.get(context);<br>
}<br>
String token = instanceId.getToken(senderId,<br>
<br>
GoogleCloudMessaging.INSTANCE_ID_SCOPE);<br>
<br>
deviceToken = token;<br>
<br>
<br>
<br>
while for the unregister method there is nothing, so I don't see how the<br>
deviceToken could not be null?<br>
<br>
Thanks,<br>
<br>
Henry<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://aerogear-users.1116366.n5.nabble.com/Get-the-deviceToken-Android-tp619p621.html" rel="noreferrer" target="_blank">http://aerogear-users.1116366.n5.nabble.com/Get-the-deviceToken-Android-tp619p621.html</a><br>
<div class="HOEnZb"><div class="h5">Sent from the aerogear-users mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Aerogear-users mailing list<br>
<a href="mailto:Aerogear-users@lists.jboss.org">Aerogear-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-users" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-users</a><br>
</div></div></blockquote></div><br></div>