简体   繁体   中英

Launch SL4A Application via adb shell

I have tried variations on starting activities including this link and the Google prescribed way of starting a background script in SL4A.

However I only need to know the command for opening the actual SL4A application through the adb shell. It is confusing which activity in that mass of code should be launched first. Also the command:

adb shell am start...

does not have the best documentation. Could someone please just give me the command to launch SL4A from adb?

Thank you so much

There is no simple command for running SL4A apps. SL4A as an activity has no command line interface.

The one you'll want to look at is this:

$ am start -a com.googlecode.android_scripting.action.LAUNCH_FOREGROUND_SCRIPT -n com.googlecode.android_scripting/.activity.ScriptingLayerServiceLauncher -e com.googlecode.android_scripting.extra.SCRIPT_PATH /sdcard/sl4a/scripts/test.py

What this does is issue an Android intent to SL4A to run a script at the specified path. This path doesn't need to be in the /sdcard/sl4a/scripts directory.

This is of course a pain to type out at the command line, especially on the device itself. There's nothing stopping you wrapping it up in a shell script. A suggested example for this is available here

So the goal was to be able to start the application from adb as if you were physically pushing the icon on your home screen. To do this I looked at the logcat data and found out that the first activity that was being launched was ScriptManager so therefore to start the application, I needed:

adb shell am start -n com.googlecode.android_scripting/.activity.ScriptManager

or in a generic case:

adb shell am start -n <package>/<activity>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM