Back

SysExec

Hello World

Executes a shell command on the android shell.

app.SysExec( command, options, maxRead, timeout ) → string

NOTE: You have to add a 'exit' command at the end of your script because the shell does not terminate automatically after finishing.

See Also: ExtExec

Example - ListDir SH

function OnStart()
{
    var delim = "\0";
    var list = app.SysExec( 'ls -ap /sdcard/;exit', "sh,log" );
    list = list.split( "\n" ).join( delim );


    lay = app.CreateLayout( "linear", "VCenter,FillXY" );

    lst = app.CreateList( list, 1, 1, "", delim );
    lay.AddChild( lst );

    app.AddLayout( lay );
}
    Copy     Copy All       Run      
number
string
number: seconds
string: log, noread, “sh” or “su”