How to get appData payload for stored push notifications?

How to get appData payload for stored push notifications?

BY 03 Oct 2013 Web Application Development

If my webapp receives a bunch of push notifications while it is not running, I can retrieve data about them like this-

var notifications = tizen.notification.getAll();
for( var i=0; i < notifications.length; ++i )
{
    //get info from notification -
    console.log(notifications[i].title);    //etc
    var appControl = notifications[i].appControl;
    console.log(appControl.operation);      //fine, data as expected
    console.log(appControl.data.length);    //always zero length array...?
}

However, there is never any data in the appControl.data field, where I expect to find the appData message body(payload) from the push notification. If I launch the application by pressing a particular notification, the appControl.data is present –

var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
var appControl = reqAppControl.appControl;
console.log( appControl.data.length);   //non-zero, appData message payload is stored in key/values

The only way it seems I can get the appData message payload for all the notifications, is by relying on the user to press every one, which is not ideal; with the native API I can easily find the payload for all the stored notifications.

Has anyone else had more luck with this?

 

 

 

 

Written by