<div dir="ltr">Yes, getToken will return null until onTokenRefresh is called the first time when it gets the real value.</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 20, 2016 at 9:06 AM, Matthias Wessendorf <span dir="ltr">&lt;<a href="mailto:matzew@apache.org" target="_blank">matzew@apache.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I looked here:<div><a href="https://developers.google.com/cloud-messaging/android/android-migrate-fcm#remove_registration" target="_blank">https://developers.google.com/cloud-messaging/android/android-migrate-fcm#remove_registration</a><br></div><div><br></div><div>It says that we no longer need, but this:</div><div><a href="https://github.com/aerogear/aerogear-android-push/blob/3.0.1/aerogear-android-push/src/main/java/org/jboss/aerogear/android/unifiedpush/gcm/AeroGearGCMPushRegistrar.java#L144-L148" target="_blank">https://github.com/aerogear/aerogear-android-push/blob/3.0.1/aerogear-android-push/src/main/java/org/jboss/aerogear/android/unifiedpush/gcm/AeroGearGCMPushRegistrar.java#L144-L148</a><br></div><div><br></div><div>was replace with explicit FCM getToken() call:</div><div><a href="https://github.com/aerogear/aerogear-android-push/blob/4.0.0/aerogear-android-push/src/main/java/org/jboss/aerogear/android/unifiedpush/fcm/AeroGearFCMPushRegistrar.java#L143-L147" target="_blank">https://github.com/aerogear/aerogear-android-push/blob/4.0.0/aerogear-android-push/src/main/java/org/jboss/aerogear/android/unifiedpush/fcm/AeroGearFCMPushRegistrar.java#L143-L147</a><br></div><div><br></div><div>I think I am a bit over asked here, on the Android internals...<br></div><div><br></div><div>Also, looks like we are not the only ones, seeing that problem :) </div><div><a href="http://stackoverflow.com/questions/37836383/android-firebase-token-is-null-on-first-run" target="_blank">http://stackoverflow.com/questions/37836383/android-firebase-token-is-null-on-first-run</a><br></div><div><br></div><div><br></div><div><br></div><div> </div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jun 19, 2016 at 8:39 PM, Matthias Wessendorf <span dir="ltr">&lt;<a href="mailto:matzew@apache.org" target="_blank">matzew@apache.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Looking at the JavaDoc for the getToken():<div><a href="https://developers.google.com/android/reference/com/google/firebase/iid/FirebaseInstanceId.html#public-methods" target="_blank">https://developers.google.com/android/reference/com/google/firebase/iid/FirebaseInstanceId.html#public-methods</a><br></div><div><br></div><div>&quot;the master token or null if the token is not yet available&quot;</div><div><br></div><div>looks like on the android lib we should not have it return null ?</div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jun 18, 2016 at 3:17 PM, Matthias Wessendorf <span dir="ltr">&lt;<a href="mailto:matzew@apache.org" target="_blank">matzew@apache.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>when I launch a fresh and clean Cordova app (I am unable to reproduce this on our native Android HelloWorld), and open it the first time for registration, I am receiving a 400 status code from the server.</div><div><br></div><div>Uninstalling the app, and launching it again, show the the problem again, ONLY on Cordova...</div><div><br></div><div>This means either the deviceToken from Android is null or invalid (according to the pattern):<br></div><div><a href="https://github.com/aerogear/aerogear-unifiedpush-server/blob/1.1.x-dev/jaxrs/src/main/java/org/jboss/aerogear/unifiedpush/rest/registry/installations/InstallationRegistrationEndpoint.java#L166-L170" target="_blank">https://github.com/aerogear/aerogear-unifiedpush-server/blob/1.1.x-dev/jaxrs/src/main/java/org/jboss/aerogear/unifiedpush/rest/registry/installations/InstallationRegistrationEndpoint.java#L166-L170</a><br></div><div><br></div><div>Doing some debugging, on the server, I see the provided token is actually null.</div><div><br></div><div>Is there a race condition or so on the client, for the initial launch of the app ? </div><div><br></div><div>I added some logging on the client (see [1]), and indeed, it looks like, on Cordova, it is actually null:</div><div><a href="https://gist.github.com/matzew/e66fa3e2bda6c4dd4655fbe5d63ed755#file-gistfile1-txt-L12" target="_blank">https://gist.github.com/matzew/e66fa3e2bda6c4dd4655fbe5d63ed755#file-gistfile1-txt-L12</a><br></div><div><br></div><div>Now... a few lines above... I see &#39;outdated&#39; c2dm packages/permissions, and a GCM: &quot;Missmatched messenger&quot;, it looks like something is still not correct.</div><div><br></div><div>Any thoughts ? </div><div><br></div><div>-Matthias </div><div><br></div><div>[1] <a href="https://github.com/matzew/aerogear-android-push/commit/1fa6aad53da4e1b9c44c59edd3086025b32a12d5" target="_blank">https://github.com/matzew/aerogear-android-push/commit/1fa6aad53da4e1b9c44c59edd3086025b32a12d5</a></div><span><font color="#888888"><div><div><br></div>-- <br><div data-smartmail="gmail_signature"><div dir="ltr"><div>Matthias Wessendorf <br><br>blog: <a href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a></div></div></div>
</div></font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div data-smartmail="gmail_signature"><div dir="ltr"><div>Matthias Wessendorf <br><br>blog: <a href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a></div></div></div>
</div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div data-smartmail="gmail_signature"><div dir="ltr"><div>Matthias Wessendorf <br><br>blog: <a href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a></div></div></div>
</div>
</div></div><br>_______________________________________________<br>
aerogear-dev mailing list<br>
<a href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br></blockquote></div><br></div>