Skip to content

Instantly share code, notes, and snippets.

@carlsmith
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlsmith/1970be371bae451e868b to your computer and use it in GitHub Desktop.
Save carlsmith/1970be371bae451e868b to your computer and use it in GitHub Desktop.
Launch one SL4A script from inside another one.
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}
package = '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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment