[Aerogear-users] Open specific page on notification received

Erik Jan de Wit edewit at redhat.com
Fri Jan 20 03:00:13 EST 2017


Like Summers said it’s in the argument passed in the callback, but I wanted
to make it even more clear with an example:

so if you send a message like this:

curl -u "00000-0000-0000-0000-000:00-0000"  \
   -v -H "Accept: application/json" -H "Content-type: application/json"  \
   -X POST  -d \
  '{
     "message": {
      "alert": "Hello ",
      "user-data": {
          "test": "I am the user data"
      }
     }
   }'  \
   https://ups-youraccount.rhcloud.com/ag-push/rest/sender

Then you can read the test data in your js callback like this:

push.register(onNotification, successHandler, errorHandler);//...
function onNotification(message) {
   console.log("user data send: " +  message.payload.test); // will
produce: "user data send: I am the user data"
   console.log("alert message " + message.alert);
}

Hope that makes things even more clear
​

On Thu, Jan 19, 2017 at 4:00 PM, Summers Pittman <supittma at redhat.com>
wrote:

> This is all done with the notification callback you send to push.register.
>
> See https://aerogear.org/docs/guides/aerogear-cordova/
> AerogearCordovaPush/#_sample_example for details.
>
> The argument your callback is passed should have all of the properties of
> the message sent from UPS in it.
>
> On Thu, Jan 19, 2017 at 9:41 AM, falconea <antonio.falcone at cg.tasgroup.it>
> wrote:
>
>> Hello, I would like to open a specific page in my cordova application
>> once a
>> notification is received. How can i do that?
>> Also, I am sending additional informations with my notification such as
>> ("person_id" "xxx_xxx"), with .userData("some_key", "with_value").
>> How do I read this informations in my hibrid application? I did not find
>> these informations on documentation.
>>
>> Thank you.
>>
>> Antonio
>>
>>
>>
>> --
>> View this message in context: http://aerogear-users.1116366.
>> n5.nabble.com/Open-specific-page-on-notification-received-tp1029.html
>> Sent from the aerogear-users mailing list archive at Nabble.com.
>> _______________________________________________
>> Aerogear-users mailing list
>> Aerogear-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/aerogear-users
>>
>
>
> _______________________________________________
> Aerogear-users mailing list
> Aerogear-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/aerogear-users
>
>


-- 
Cheers,
       Erik Jan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/aerogear-users/attachments/20170120/4c57a092/attachment-0001.html 


More information about the Aerogear-users mailing list