QPython is a script engine that allows you to run python programs on Android. It comes with SL4A (Scripting Layer for Android) built in. SL4A has access to many of the APIs available to full-fledged Android applications, but has a greatly simplified interface that makes it easy to get things done by wrapping it in Python modules. It supports my really old Gingerbread 2.3.5 OS and can be installed directly from the PlayStore. It really is a great piece of standalone software that will get you coding in minutes, but I decided to run this over SSH with SSHDroid. Take your time to properly setup and protect SSHDroid, get things like the IP address, then try this hello world application.
On your local PC, create a file called test.py and add
import androidhelper droid=androidhelper.Android() droid.makeToast("hello world!")
Copy it to the QPython scripts folder on the SD card (note, your ssh port number and IP Address will be different)
scp -P 2017 test.py firstname.lastname@example.org:/mnt/sdcard/qpython/scripts
To test the script, you can do it via the QPython GUI interface. You can also run it by calling QPython's python interpreter from a logged in SSH session, and pass it your script to execute. It's a bit like calling
ssh -p 2017 email@example.com /data/data/org.qpython.qpy/files/bin/qpython.sh /mnt/sdcard/qpython/scripts/test.py
If all looks good, you might want to now call it over SSH. Log out of your SSH session. Wrap your whole command in an alias to issue a quick command from your Linux terminal
alias phone-helloworld = 'ssh -p 2017 firstname.lastname@example.org "/data/data/org.qpython.qpy/files/bin/qpython.sh /mnt/sdcard/qpython/scripts/test.py"'