android - Launch an SL4A script from an SL4A script -
i start background sl4a script (on remote device) within different sl4a script. can launch script terminal running this:
$ start -a \ com.googlecode.android_scripting.action.launch_background_script -n \ com.googlecode.android_scripting/.activity.scriptinglayerservicelauncher -e \ com.googlecode.android_scripting.extra.script_path /sdcard/sl4a/scripts/main.py
i can't translate startactivity
call in python.
the answer a different question on opening twitter client works nicely, don't know how extend code. example, how add script path, , put line com.googlecode.android_scripting/.activity.scriptinglayerservicelauncher
?
this function launch sl4a script inside one.
the first argument should path script want launch. script can in language have interpreter installed for.
the second argument optional , should bool. defaults false
. controls whether terminal visible, can see output , errors. not effect whether script has ui or not.
from android import android droid = android() def launch_script(path, visible=false): visibilty = 'fore' if visible else 'back' activity = 'com.googlecode.android_scripting.action.launch_{0}ground_script'.format(visibilty) extras = {'com.googlecode.android_scripting.extra.script_path': path} packagename = 'com.googlecode.android_scripting' classname = 'com.googlecode.android_scripting.activity.scriptinglayerservicelauncher' intent = droid.makeintent(activity, none, none, extras, none, packagename, classname).result droid.startactivityintent(intent)
there's gist code here.
Comments
Post a Comment