Hello Miguel,

thanks for reaching out.

One thing on the OpenShift documentation, what the URL you are referencing ? 

A few things on OpenShift versus local deployment:

* http vs. https:
For the OpenShift cartridges we have enabled https, If you run locally (e.g. inside of your JBoss/WildFly container) https is a pain, hence http might be referenced somewhere

CONTEXT:
On Openshift the UnifiedPush Server is deployed as root (/) context. If you locally deploy the war file, the context is /nameOfYourWarFile


Regarding not receving messages on the Android device:
* what is the Android OS on the device
* is there an (active) Google account on the device 


One more question: The registration works, right ? 

var pushConfig = {
// senderID is only used in the Android/GCM case
senderID: "SomeSenderID",
pushServerURL: "someULR",
variantID: "someID",
variantSecret: "someSecret",
alias: "someAlias"
}


Question: Do you see the device listed as the installation, on the OpenShift hosted Push Server ? 

Thanks,
Matthias




On Wed, Feb 19, 2014 at 9:58 AM, Miguel Lemos <miguel21op@gmail.com> wrote:
Hello,

I'm still struggling, for saying the least, with Aerogear documentation in order to make a Cordova / Android app  receive push notifications.
Amazingly one of the most unexpected issues has been with the correct string to use on URLs to register or sending the notifications.

Examples given by documentation:

Openshift:

curl -u "{PushApplicationID}:{MasterSecret}"
   -v -H "Accept: application/json" -H "Content-type: application/json"
   -X POST
   -d '{
       "someKey":"someValue",
       "alert":"HELLO!",
       "sound":"default",
       "badge":7,
       "simple-push":"version=123"
     }'
http://SERVER:PORT/CONTEXT/rest/sender/broadcast

Aerogear:

curl -3 -u "{pushApplicationID}:{masterSecret}"
   -v -H "Accept: application/json" -H "Content-type: application/json"
   -X POST -d '{"message": {"alert":"AeroGear UnifiedPush and Apache Cordova 3.0.6", "badge":1}}'
   https://SERVER:PORT/CONTEXT/rest/sender
  

How the above examples, apparently mean that, in my case, I must use something like: https://aerogear-metalpush.rhcloud.com/rest/sender
maybe is very obvious for someone inside Aerogear lingo, but not at all for me...

Anyway, after I managed to overcome this, the answer I get from the server is this one (stripped from more irrelevant parts):

> POST /rest/sender HTTP/1.1
> Authorization: Basic MDBhMjFjZTMtYTdkOS00YzhjLWI1ODMtOWYwMjEwYTYzNGU1Ojk0MTE4NmIzLWVjNmEtNGY0OC1iMjZiLTJkMDYxZWIyM2Q5Yg==
> User-Agent: curl/7.30.0
> Host: aerogear-metalpush.rhcloud.com
> Accept: application/json
> Content-type: application/json
> Content-Length: 50
>
} [data not shown]
* upload completely sent off: 50 out of 50 bytes
< HTTP/1.1 200 OK
< Date: Tue, 18 Feb 2014 20:58:18 GMT
* Server Apache-Coyote/1.1 is not blacklisted
< Server: Apache-Coyote/1.1
< Content-Type: application/json
< Content-Length: 13
< Vary: Accept-Encoding
<
{ [data not shown]
100    63  100    13  100    50     11     44  0:00:01  0:00:01 --:--:--    44Job submitted
* Connection #0 to host aerogear-metalpush.rhcloud.com left intact


As far as I can guess, this means that the request was accepted. Nevertheless, I receive nothing on the client's side.
On my phone the successHandler function throws a success message, meaning that the equipment has managed to register at the service.

And my code to receive the notifications is the same given in some examples:

function onNotification(e) {
    alert(e.alert);
)

But nothing happens, tough. Thanks for giving me some clues to solve this.

Miguel


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



--
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf