Set a Wallpaper

//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

Responses

0 Replies