코르도바 이미지 공유 cordova-plugin-file-opener2 간단 예제

function eventFileDownload(thisObj) {
	// 로딩 화면 띄우기
    eventPopLoader();
    var file = $(thisObj).data("image"); // 이미지명 image.jpg
    var image = 'http://example.com/file_upload/'+file; // 이미지가 저장되어있는 경로+이미지명
    
    var options = {
   		message: '', // not supported on some apps (Facebook, Instagram)
    	subject: '', // fi. for email
    	files: [image] // an array of filenames either locally or remotely
    };
    
    var onSuccess = function(result) {
    	//로딩 화면 제거
    	eventRemoveLoader();
    	if(result.app != "") {
    		alert("공유되셨습니다.");
   			console.log("Share completed? " + result.completed); // On Android apps mostly return false even while it's true
    		console.log("Shared to app: " + result.app); // On Android result.app since plugin version 5.4.0 this is no longer empty. On iOS it's empty when sharing is cancelled (result.completed=false)
    	}
    };
		
   var onError = function(msg) {
   		//로딩 화면 제거
    	eventRemoveLoader();
   		alert("공유 실패.");
        console.log("Sharing failed with message: " + msg);
   };
   
   window.plugins.socialsharing.shareWithOptions(options, onSuccess, onError);
}

댓글

Designed by JB FACTORY