语言

Menu
Sites
Language
How to open gallery from Web app

Hi, guys.

How to open gallery with parameter select from my web app. I must add image for use pic of my app (contact).

Message Port Api can help me and how? Or something else?

Thanks in advance.

编辑者为: Brock Boland 17 3月, 2014 原因: Paragraph tags added automatically from tizen_format_fix module.

响应

6 回复
konduri sai swathi
Hi , Try this below code
var appControl = new tizen.ApplicationControl(
			"http://tizen.org/appcontrol/operation/pick",
			null,
	"IMAGE");
	var appControlReplyCallback = {
			onsuccess: function(data) {
				for(var i=0; i < data.length; i++) {
					console.log("#"+i+" key:"+data[i].key);
					for(var j=0; j < data[i].value.length; j++) {
						console.log("   value#"+j+":"+data[i].value[j]);
					}
				}
			},
			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 );
it will launch gallery and allows you to pick an image .
Enjo
Thank you! With this scenario, can I get ringtoneURI?
konduri sai swathi
Hi , Will get back to you soon regarding picking audio file .
Enjo
Deal)
Lakshmi Grandhi
Hi , There is no such feature which can handle the app control to pick audio file because there is no application which shows all the audio files of the phone that can be launched .
konduri sai swathi
Hi , Create an application which retrieves all audio files of the phone and then using appcontrol from your current application access the audio files application to pick any audio file.
    <tizen:app-control>
        <tizen:src name="index.html"/>
        <tizen:operation name="http://tizen.org/appcontrol/operation/audio_pick"/>
        <tizen:uri name="file"/>
    </tizen:app-control>
in JS file :
var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
		if (reqAppControl) {
			reqAppControl.replyResult([new tizen.ApplicationControlData("source",[audio_src])]);
			var app = tizen.application.getCurrentApplication();
			app.exit();
		}
add the above code in config.xml of audio files app . "audio_src" is the source file of the audio you selected ,which will be sent to your calling app using appcontrol . And add the below code in your application to receive aoocontrol data :
var appControl = new tizen.ApplicationControl(
		"http://tizen.org/appcontrol/operation/audio_pick",
		null,
		null,null);
function successCB(appInfos, appControl)
{
	var appId = appInfos[0].id; // select first app's id
	var appControlReplyCallback = {
			onsuccess: function(data) {
				for(var i=0; i < data.length; i++) {
					console.log(data[i].key);
					for(var j=0; j < data[i].value.length; j++) {
						console.log("Value is : "+data[i].value[j]);
					}
				}
			},
			onfailure: function() {
				console.log('The launch application control failed');
			}
	}
    tizen.application.launchAppControl(appControl, appId,
       function() {console.log("launch application control succeed"); },
       function(e) {console.log("launch application control failed. reason: " + e.message); },
       appControlReplyCallback );
}
	tizen.application.findAppControl(appControl, successCB);