By Palitsyna
16 Sep 2015 03:41
//JavaScript:
try {
var appControl = new tizen.ApplicationControl(
"http://tizen.org/appcontrol/operation/pick",
null,
"image/*",
null,
[new tizen.ApplicationControlData("http://tizen.org/appcontrol/data/selection_mode", ["single"])]);
var appControlReplyCallback = {
onsuccess: function(reply) {
var path = reply[1].value[0];
path = "file://" + path;
tizen.filesystem.resolve(path, function(imageFile) {
try {
tizen.systemsetting.setProperty("HOME_SCREEN",
imageFile.toURI().replace("file://", ""),
function(){alert("Success");},
function(){alert("Error");});
} catch (error) {
alert("Error: " + error);
}
});
},
onfailure: function() {
console.log("The launch application control failed");
}
}
tizen.application.launchAppControl(
appControl,
null,
function() {console.log("launch application control succeed"); },
function(e) {console.log("launch application control failed. reason: " + e.message); },
appControlReplyCallback
);
}
catch (e) {
alert("Error " + e.name + " : " + e.message);
}
// Requires the following Tizen Privileges:
// <tizen:privilege name="http://tizen.org/privilege/application.launch"/>
// <tizen:privilege name="http://tizen.org/privilege/filesystem.read"/>
// <tizen:privilege name="http://tizen.org/privilege/setting"/>
// Add this lines to config.xml file
You must log in to use this service. Log in now?
The tag you entered already exists.
Do you want to report this post as spam?
The post has been reported as spam.
cannot be empty.
Are you sure you want to cancel and return to the list?
The code has been copied to the clipboard.
Enter a title.
Enter a description.