[aerogear-dev] FCM: Cordova/Android bug ?

Julio Cesar Sanchez Hernandez jusanche at redhat.com
Mon Jun 20 04:28:04 EDT 2016


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

On Mon, Jun 20, 2016 at 10:02 AM, Matthias Wessendorf <matzew at apache.org>
wrote:

> Ok, so IMO that sounds like a bug in the Android lib, so the UPS
> registration should be fired after 'onTokenRefresh' is called
>
> Also, cordova question. Do we need to define our
> "UnifiedPushInstanceIDListenerService" in the plugin's config section for
> the manifest? Or is this, inside the AGPush lib good enough ?
>
> https://github.com/aerogear/aerogear-android-push/blob/master/aerogear-android-push/src/main/AndroidManifest.xml#L24-L28
>
> Thanks,
> Matthias
>
> On Mon, Jun 20, 2016 at 9:46 AM, Julio Cesar Sanchez Hernandez <
> jusanche at redhat.com> wrote:
>
>> Yes, getToken will return null until onTokenRefresh is called the first
>> time when it gets the real value.
>>
>> On Mon, Jun 20, 2016 at 9:06 AM, Matthias Wessendorf <matzew at apache.org>
>> wrote:
>>
>>> I looked here:
>>>
>>> https://developers.google.com/cloud-messaging/android/android-migrate-fcm#remove_registration
>>>
>>> It says that we no longer need, but this:
>>>
>>> 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
>>>
>>> was replace with explicit FCM getToken() call:
>>>
>>> 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
>>>
>>> I think I am a bit over asked here, on the Android internals...
>>>
>>> Also, looks like we are not the only ones, seeing that problem :)
>>>
>>> http://stackoverflow.com/questions/37836383/android-firebase-token-is-null-on-first-run
>>>
>>>
>>>
>>>
>>>
>>> On Sun, Jun 19, 2016 at 8:39 PM, Matthias Wessendorf <matzew at apache.org>
>>> wrote:
>>>
>>>> Looking at the JavaDoc for the getToken():
>>>>
>>>> https://developers.google.com/android/reference/com/google/firebase/iid/FirebaseInstanceId.html#public-methods
>>>>
>>>> "the master token or null if the token is not yet available"
>>>>
>>>> looks like on the android lib we should not have it return null ?
>>>>
>>>> On Sat, Jun 18, 2016 at 3:17 PM, Matthias Wessendorf <matzew at apache.org
>>>> > wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> 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.
>>>>>
>>>>> Uninstalling the app, and launching it again, show the the problem
>>>>> again, ONLY on Cordova...
>>>>>
>>>>> This means either the deviceToken from Android is null or invalid
>>>>> (according to the pattern):
>>>>>
>>>>> 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
>>>>>
>>>>> Doing some debugging, on the server, I see the provided token is
>>>>> actually null.
>>>>>
>>>>> Is there a race condition or so on the client, for the initial launch
>>>>> of the app ?
>>>>>
>>>>> I added some logging on the client (see [1]), and indeed, it looks
>>>>> like, on Cordova, it is actually null:
>>>>>
>>>>> https://gist.github.com/matzew/e66fa3e2bda6c4dd4655fbe5d63ed755#file-gistfile1-txt-L12
>>>>>
>>>>> Now... a few lines above... I see 'outdated' c2dm
>>>>> packages/permissions, and a GCM: "Missmatched messenger", it looks like
>>>>> something is still not correct.
>>>>>
>>>>> Any thoughts ?
>>>>>
>>>>> -Matthias
>>>>>
>>>>> [1]
>>>>> https://github.com/matzew/aerogear-android-push/commit/1fa6aad53da4e1b9c44c59edd3086025b32a12d5
>>>>>
>>>>> --
>>>>> Matthias Wessendorf
>>>>>
>>>>> blog: http://matthiaswessendorf.wordpress.com/
>>>>> twitter: http://twitter.com/mwessendorf
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Matthias Wessendorf
>>>>
>>>> blog: http://matthiaswessendorf.wordpress.com/
>>>> twitter: http://twitter.com/mwessendorf
>>>>
>>>
>>>
>>>
>>> --
>>> Matthias Wessendorf
>>>
>>> blog: http://matthiaswessendorf.wordpress.com/
>>> twitter: http://twitter.com/mwessendorf
>>>
>>> _______________________________________________
>>> aerogear-dev mailing list
>>> aerogear-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>>>
>>
>>
>> _______________________________________________
>> aerogear-dev mailing list
>> aerogear-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>>
>
>
>
> --
> Matthias Wessendorf
>
> blog: http://matthiaswessendorf.wordpress.com/
> twitter: http://twitter.com/mwessendorf
>
> _______________________________________________
> aerogear-dev mailing list
> aerogear-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/aerogear-dev/attachments/20160620/c7aa75af/attachment.html 


More information about the aerogear-dev mailing list