On Wed, Feb 19, 2014 at 11:08 AM, Matthias Wessendorf <matzew@apache.org> wrote:



On Wed, Feb 19, 2014 at 10:53 AM, Miguel Lemos <miguel21op@gmail.com> wrote:
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:


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






_______________________________________________
aerogear-dev mailing list
aerogear-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/aerogear-dev