语言

Menu
Sites
Language
AppContol - Pick-Operation doesn't work

I use the code from the example


var appControl = new tizen.ApplicationControl(
     "http://tizen.org/appcontrol/operation/pick",
     null,
     "image/jpeg",
     null);

 var appControlReplyCallback = {
     // callee sent a reply
     onsuccess: function(data) {
         for (var i = 0; i < data.length; i++) {
             if (data[i].key == "http://tizen.org/appcontrol/data/selected") {
                 console.log('Selected image is ' + data[i].value[0]);
             }
         }
     },
     // callee returned failure
     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 );

Myfiles open and I can select a image, but I never return back to may app after selecting....

响应

9 回复
Raghavendra Reddy Shiva

Don't see any issues in the sample code. I have similar code, which works fine for me.

//Function to retrieve the selected image details from gallery 
var GallareyImageSelected = {
         onsuccess: function(data) {
           for(var i=0; i < data.length; i++) {    
                  if (data[i].key == "http://tizen.org/appcontrol/data/selected")
                  {                      
                      gSelectedImagePath= data[i].value[0];
                      console.log("Image path set: "+ gSelectedImagePath);                  
                  }
           }          
        },
        // Something went wrong
        onfailure: function() {
           console.log('The launch application control failed');
        }
     }

//Function to launch gallery application to allow selecting the image
function browseGallery() {
         console.log('Gallery will be launched..');
         var appControl = new tizen.ApplicationControl(
                    "http://tizen.org/appcontrol/operation/pick",
                    null,
                    "image/jpeg",
                    null);
         tizen.application.launchAppControl(appControl, null,
                    function() {console.log("Gallery launch successful"); },
                    function(e) {console.log("Gallery launch failed. Reason: " + e.message); },
                    GallareyImageSelected);    
}

konduri sai swathi

Hi,

Your code worked for me, or else try the below code : 

var appControl = new tizen.ApplicationControl(
    		"http://tizen.org/appcontrol/operation/pick",
			null,
	"IMAGE");
	var appControlReplyCallback = {
			onsuccess: function(data) {
				var img_src=data[0].value[0];
				console.log(img_src);
			},
			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 );

 

Alexander AVSukhov

Hello,

Make sure that you are using the latest version of SDK.

Tested on 2.2.0 official, all works fine.

Marco Buettner

I use Tizen SDK 2.2 and a RD-PQ developer device with also Tizen 2.2 (Core-Firmware)

Alexander AVSukhov

Hi,

Try to use correct ApplicationId for launchAppControl()

For example:

tizen.application.launchAppControl(
             appControl,
             "tizen.gallery",
             function() {console.log("launch application control succeed"); },
             function(e) {console.log("launch application control failed. reason: " + e.message); },
             appControlReplyCallback );

 

MyFiles app that you are launched by AppControl have a black theme?

Marco Buettner

yes, it have a black theme

Alexander AVSukhov

Try to use ApplicationId = tizen.myfile

Marco Buettner

I will try it tonight

Marco Buettner

I have flashed my RD-PQ again. Now I use the Ref-Firmware of Tizen 2.2. Now the Pick-Operation works but now I can't use Create_Content-Operation :) I hope it works now proberly on the devices of the testers from the Seller office. :)