언어 설정

Menu
Sites
Language
How to access data exported by other services?

 

How to access data passed by other services like alarms, notifications using Application Control (ApplicationControlData)?

Example:

 

var appControl =
       new tizen.ApplicationControl(
                  "http://tizen.org/appcontrol/operation/share",
                  "share.html",
                  "image/*",
                  null,
                  [new tizen.ApplicationControlData("images",
                                                    [imagedata1, imagedata2])] );
 

How to access value for the key "images" from the launched application?

 

 

Edited by: Brock Boland on 17 3월, 2014 Reason: Paragraph tags added automatically from tizen_format_fix module.

Responses

6 댓글
Raghavendra Reddy Shiva
ApplicationControlData[] is an array with data needed by the provider application. So assuming you should be able to access the attributes the same way as it's accessed when the control is returned back with reply data (with RequestedApplicationControl). i.e you can access it using the key/Value pairs in the provider application JS file. Above code as an example (considering with single Key element data), var keyword = data.key; // You can loop depending on the "value.length" var keyvalue1 = data.value[0]; var keyvalue2 = data.value[1]; Please share your code sample, if you aren't able to access.
anfas ci
I created a notification from my app using following code: function SimpleNotification(title, message) { var imagedata1 = "image1.jpg"; var imagedata2 = "image2.jpg"; try { var urlData1 = "my test url"; var appControl = new tizen.ApplicationControl( "http://tizen.org/appcontrol/operation/view", "view.html", "image/*", null, [new tizen.ApplicationControlData("images", [imagedata1, imagedata2])] ); var notificationDict = { content : message, appControl : appControl, appId : tizen.application.getAppContext().appId }; var notification = new tizen.StatusNotification("SIMPLE", title, notificationDict); tizen.notification.post(notification); console.log("Notification sent"); } catch (err) { tizen.logger.error(err.name + ": " + err.message); } } When clicking on the generated notification, my application will be opened and view.html will be launched. In the view.html, I want to access the app control data which was passed with the notification. ie. Here I want to access values for the key "images"?
anfas ci
I got the solution: var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl(); if (reqAppControl) { var reqData = reqAppControl.appControl.data; console.log("App ctrl Key: " + reqData[0].key+" Data:"+reqData[0].value); //Update the index for more key/value pairs }
Saeid Farivar

When I use your solution, the reqData is always empty???

Any idea why???

Saeid Farivar

Ok. found a solution.

Turns out I was sending

var extra_data = [new tizen.ApplicationControlData("type", "type"),
                            new tizen.ApplicationControlData("data", "data")];

and it was not working...

the problem is that the value part should be like ["type"]...

So, this works

var extra_data = [new tizen.ApplicationControlData("type", ["type"]),
                            new tizen.ApplicationControlData("data", ["data"])];

 

AVSukhov

Hello,

Yes. Acoording documetation:

https://developer.tizen.org/dev-guide/2.3.0/org.tizen.web.apireference/html/device_api/mobile/tizen/application.html

interface ApplicationControlData has two attributes key/value, and value should be DOMString[] - array.