sl4a 

Send to Kindle
home » snippets » android » sl4a



Snippets

# Set up SL4A to use port 2222 for the server.
# Then start a private server.
# Now, forward local port to the SL4A port.
export AP_PORT=9999
adb forward tcp:$AP_PORT tcp:$AP_PORT

# Finally, connect via python and try an example.
# Run local python.
python

Try this script at the interpreter.  Make sure you have android-scripting.googlecode.com/hg/python/ase/android.py somewhere where you can import it

import android
droid = android.Android()
# This message shows up and disappears quickly.
droid.makeToast("Hello, world!")
# This notification disappears once you click on it.
droid.notify("Title", "Hello, World")
# Vibrate a tiny bit.
droid.vibrate(250)

Misc

# In adb shell.
alias python='sh /sdcard/chirayu/scripts/python.sh'