Image or File sharing through Facebook, Email, Message, Whatsapp, BL, Wifi Direct etc

This code shows how to share an image or a file through Facebook, Email, Message, Whatsapp, BL, Wifi Direct etc. Here an image file named “image.png” located in “images” folder of filesystem is used.
//config.xml
<tizen:privilege name="http://tizen.org/privilege/filesystem.read"/>
<tizen:privilege name="http://tizen.org/privilege/filesystem.write"/>

//main.js
var imageFileSource= 'image.png';
tizen.filesystem.resolve("images", function(images) {
    	var imagePath = images.resolve(imageFileSource);
    	var appControlData = [new tizen.ApplicationControlData("http://tizen.org/appcontrol/data/path", [imagePath.toURI()])];
    	var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/share", imagePath.toURI(), 
    	        "image/*", null, appControlData);
    	tizen.application.launchAppControl(appControl, null,
    	        function(){
    	            console.log("launch appControl succeeded");
    	        }, 
    	        function(e){
    	            console.log("No Sharer", "Your phone doesn't seem to have a default image sharer");
    	        }, 
    	null);  });

Responses

0 Replies