[aerogear-dev] Issues with Aerogear on Cordova
Corinne Krych
corinnekrych at gmail.com
Wed Feb 19 07:03:04 EST 2014
Yep well spotted.
That was my issue too when testing:
https://github.com/aerogear/aerogear-pushplugin-cordova/pull/14
I think it would worth a Note warning in the readme ;)
++
Corinne
On 19 February 2014 11:27, Sebastien Blanc <scm.blanc at gmail.com> wrote:
>
>
>
> On Wed, Feb 19, 2014 at 11:08 AM, Matthias Wessendorf <matzew at apache.org>wrote:
>
>>
>>
>>
>> On Wed, Feb 19, 2014 at 10:53 AM, Miguel Lemos <miguel21op at gmail.com>wrote:
>>
>>> Hello,
>>>
>>> 1 > The Openshift explanation:
>>>
>>>
>>> https://www.openshift.com/blogs/mobile-push-simplified-with-the-aerogear-push-server-on-openshift
>>>
>>> 2 > I insist: the documentation / examples you give about the correct
>>> URLs to use is incoherent and not enough clear (sorry, this is my opinion);
>>>
>>
>> ah, ok - yeah, that's an outdated blog of our first release (0.8.0); We
>> will see if we can update that, as APIs have changed
>>
>>
>>
>>>
>>> 3 > The Android version I use on the testing device: 4.2.1 and Cordova
>>> 3.3
>>>
>>> 4 > As I told you in my previous post the device registers correctly,
>>> meaning there is a token, etc of it on the server. See picture attached;
>>>
>>
>>
>> Great - the device is registered, that's good news
>>
>>
>>
>>
>>>
>>> 5> Yes there is an account, etc on Google service, where the Google
>>> cloud Messaging for Android is set to on (if you want I can send to you the
>>> credentials; later on I'll generate new ones);
>>>
>>> 6 > Please see attached the libraries I'm using on my Android app;
>>>
>>> 7 > The Javascript code inside my app:
>>>
>>> document.addEventListener('deviceready', function(){
>>>
>>> var pushConfig = { // credentials not real; I
>>> thing this goes live...
>>> senderID: "278695548260",
>>> pushServerURL: "https://aerogear-metalpush.rhcloud.com",
>>> variantID: "821460c5-ez9f-41d8-903a-61e7bd132038",
>>> variantSecret: "43b0e5e4-f217-4f29-b15b-85f8f5748ee6"
>>> }
>>>
>>> try {
>>> push.register(successHandler, errorHandler, {"badge": "true",
>>> "sound": "true",
>>> "alert": "true", "ecb": "onNotification", pushConfig:
>>> pushConfig});
>>>
>>> } catch (err) {
>>> txt = "Erro encontrado.\n\n";
>>> txt += "Descrição do erro: " + err.message + "\n\n";
>>> alert(txt);
>>> }
>>>
>>> function successHandler(result) {
>>> var respush = document.getElementById("pushst");
>>> respush.innerHTML = "Notificações: registo efetuado";
>>> }
>>>
>>> function errorHandler(error) {
>>> var respush = document.getElementById("pushst");
>>> respush.innerHTML = "Notificções: registo falhado";
>>> }
>>>
>>> function onNotification(e) {
>>> alert(e.alert);
>>> }
>>>
>>
>>
>> Oh, just a thought - the scope of the 'onNotification'
>>
>> I always used it as a globla function, like:
>>
>> https://gist.github.com/matzew/ea739b09b3fbef487edd
>>
>
> You spotted the issue !
> Miguel I just tried your code and indeed since the onNotif is not global
> it isn't called , try to get the same structure as in
> https://github.com/aerogear/aerogear-pushplugin-cordova/tree/master/example and
> it should work.
>
>
>>
>>
>>>
>>> }, false);
>>>
>>>
>>> I think I'm answering to all your questions. Any help appreciated.
>>> Feel free to ask whatever you need to enlighten this situation.
>>>
>>> Miguel
>>>
>>>
>>>
>>>
>>
>>
>> --
>> Matthias Wessendorf
>>
>> blog: http://matthiaswessendorf.wordpress.com/
>> sessions: http://www.slideshare.net/mwessendorf
>> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/aerogear-dev/attachments/20140219/80cee288/attachment-0001.html
More information about the aerogear-dev
mailing list