<div dir="ltr"><a href="https://issues.jboss.org/browse/AGDROID-560">https://issues.jboss.org/browse/AGDROID-560</a><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 20, 2016 at 1:27 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">I have seen that with a native app now too.<div><br></div><div>I will create a JIRA </div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 20, 2016 at 11:01 AM, Oleg Matskiv <span dir="ltr">&lt;<a href="mailto:omatskiv@redhat.com" target="_blank">omatskiv@redhat.com</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"><div>And instanceId<span>.</span>getToken() indeed returned null on first registration.<br></div>So native unified-push-helloworld app [1] can be used to reproduce this issue.<br><br>[1] <a href="https://github.com/jboss-mobile/unified-push-helloworld" target="_blank">https://github.com/jboss-mobile/unified-push-helloworld</a><br></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 20, 2016 at 10:40 AM, Oleg Matskiv <span dir="ltr">&lt;<a href="mailto:omatskiv@redhat.com" target="_blank">omatskiv@redhat.com</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"><div>Hi,<br><br></div>I had very similar problem with native app (unified-push-helloworld), 400 code on first registration. <br>I&#39;ll check getToken() return value to verify that its actually same issue.<br></div><div class="gmail_extra"><div><div><br><div class="gmail_quote">On Mon, Jun 20, 2016 at 10:28 AM, Julio Cesar Sanchez Hernandez <span dir="ltr">&lt;<a href="mailto:jusanche@redhat.com" target="_blank">jusanche@redhat.com</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 think that should be enough, if the plugin uses the AGPush lib and the lib has that on the AndroidManifest, it should be merged with the app AndroidManifest. In the end a Cordova app is an Android app, it should work the same way the Android app works</div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 20, 2016 at 10:02 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">Ok, so IMO that sounds like a bug in the Android lib, so the UPS registration should be fired after &#39;<span style="font-size:12.8px">onTokenRefresh&#39; is called</span><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Also, cordova question. Do we need to define our &quot;UnifiedPushInstanceIDListenerService&quot; in the plugin&#39;s config section for the manifest? </span><span style="font-size:12.8px">Or is this, inside the AGPush lib good enough ?</span></div><div><span style="font-size:12.8px"><a href="https://github.com/aerogear/aerogear-android-push/blob/master/aerogear-android-push/src/main/AndroidManifest.xml#L24-L28" target="_blank">https://github.com/aerogear/aerogear-android-push/blob/master/aerogear-android-push/src/main/AndroidManifest.xml#L24-L28</a></span><br></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Thanks,</span></div><div><span style="font-size:12.8px">Matthias</span></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 20, 2016 at 9:46 AM, Julio Cesar Sanchez Hernandez <span dir="ltr">&lt;<a href="mailto:jusanche@redhat.com" target="_blank">jusanche@redhat.com</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">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"><div><div>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></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><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><div><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></div></div>_______________________________________________<br>
aerogear-dev mailing list<br>
<a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">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>
<br>_______________________________________________<br>
aerogear-dev mailing list<br>
<a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">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><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" target="_blank">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>
</div></div><br>_______________________________________________<br>
aerogear-dev mailing list<br>
<a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">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><br clear="all"><br>-- <br></div></div><span><font color="#888888"><div data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div>Oleg Matskiv<br></div>Associate Quality Engineer<br></div><div>Red Hat Mobile Application Platform<br></div><a href="mailto:omatskiv@redhat.com" target="_blank">omatskiv@redhat.com</a><br></div></div></div></div>
</font></span></div>
</blockquote></div><br><br clear="all"><br>-- <br><div data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div>Oleg Matskiv<br></div>Associate Quality Engineer<br></div><div>Red Hat Mobile Application Platform<br></div><a href="mailto:omatskiv@redhat.com" target="_blank">omatskiv@redhat.com</a><br></div></div></div></div>
</div>
</div></div><br>_______________________________________________<br>
aerogear-dev mailing list<br>
<a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">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><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 class="gmail_signature" 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>