Open specific page on notification received

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Open specific page on notification received

falconea
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Aerogear-users] Open specific page on notification received

Summers Pittman
This is all done with the notification callback you send to push.register.


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 <[hidden email]> 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
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users


_______________________________________________
Aerogear-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Aerogear-users] Open specific page on notification received

Erik Jan de Wit

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 <[hidden email]> wrote:
This is all done with the notification callback you send to push.register.


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 <[hidden email]> 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
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users


_______________________________________________
Aerogear-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users




--
Cheers,
       Erik Jan

_______________________________________________
Aerogear-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Aerogear-users] Open specific page on notification received

falconea
Ok now it's more clear. In order to open a new page on notification opened, i can set window.location="page2.html" in onNotification method?

@erik, sorry for the private message. i did want to post here, it was a mistake :)

Erik Jan de Wit wrote
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 <[hidden email]>
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 <[hidden email]>
> 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
>> [hidden email]
>> https://lists.jboss.org/mailman/listinfo/aerogear-users
>>
>
>
> _______________________________________________
> Aerogear-users mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/aerogear-users
>
>


--
Cheers,
       Erik Jan

_______________________________________________
Aerogear-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Aerogear-users] Open specific page on notification received

Erik Jan de Wit
Ok now it's more clear. In order to open a new page on notification opened, i
can set window.location="page2.html" in onNotification method?

You could, although I would suggest using a javascript framework to write your client app

--
Cheers,
       Erik Jan

_______________________________________________
Aerogear-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Aerogear-users] Open specific page on notification received

falconea
I am using jQuery. Do you suggest something else than window.location ?

Erik Jan de Wit wrote
>
> You could, although I would suggest using a javascript framework to write
your client app

--
Cheers,
       Erik Jan

_______________________________________________
Aerogear-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Aerogear-users] Open specific page on notification received

Erik Jan de Wit
It's a mobile app, so something with page transition would be nice, if you are using jQuery why not have a look at how jQuery mobile is doing page transitions. But feel free to do a simple window.location that will work as well.

On Fri, Jan 20, 2017 at 3:56 PM, falconea <[hidden email]> wrote:
I am using jQuery. Do you suggest something else than window.location ?


Erik Jan de Wit wrote
>>
>> You could, although I would suggest using a javascript framework to write
> your client app
>
> --
> Cheers,
>        Erik Jan
>
> _______________________________________________
> Aerogear-users mailing list

> Aerogear-users@.jboss

> https://lists.jboss.org/mailman/listinfo/aerogear-users





--
View this message in context: http://aerogear-users.1116366.n5.nabble.com/Open-specific-page-on-notification-received-tp1029p1037.html
Sent from the aerogear-users mailing list archive at Nabble.com.
_______________________________________________
Aerogear-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users



--
Cheers,
       Erik Jan

_______________________________________________
Aerogear-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users
Loading...