Hey all! Haven't found a solution to this prob either, and I'd also like to allow the user to choose an app from their SDCard, not limmited to internal storage. As noted earlyer in this thread, ChooseFile works fine for the device's internal storage, but when choosing from the SDCard, available in the "show roots" option of the file picker dialog, I get null.
I also asked about this a few months ago, but nobody knew how to help me, so I gave it some time and google love. Google love got me here.
Here is my code, maybe I'm doing something wrong? My code is a mashup of the ChooseFile example, and the CheckPermissions example, with changes to combine the two. When I check permissions, I appear to have ExtSDcard and Storage permissions.
Any help is appreciated.
*******************************
function OnStart() {
lay = app.CreateLayout( "linear", "VCenter,FillXY" );
txt = app.CreateButton( "Go" );
txt.SetOnTouch(go);
lay.AddChild(txt);
conf = app.CreateButton("Confirm");
conf.SetOnTouch(confirmPermissions);
lay.AddChild(conf);
app.AddLayout( lay );
} //onStart
go = function() {
var check = app.CheckPermission("ExtSDcard,Storage");
if(check) {
alert("Some permissions are not ranted to this app. " + check);
return;
} //if
app.ChooseFile("Choose a file", "*/*", chosen);
} //go
chosen = function(path) {
app.Alert("file: " + path);
} //chosen
function confirmPermissions() {
var check = app.CheckPermission("ExtSDcard,Storage");
if( check) {
app.GetPermission( check, PermissionResult );
} else {
alert( "everything ok!" );
} //if
} //confirmPermissions
function PermissionResult( ungranted ) {
alert( "ungranted: " + ungranted );
} //PermissionResult
*******************************
Thx!