I would like to test my applications on real device through ADB. I've found the code but from Python 2.x. Could someone help me to make it work with Python 3.x?
I have Qpython3 on my smartphone, ADB in windows command list my phone as available device (I can reboot it), but I can't handle application test.
Code below should be at the beginning of the application:
#!/usr/bin/env python
import subprocess
ADB = r'D:\Programy\sdk\platform-tools\adb.exe'
APPLICATION = 'test.py'
TARGET = '/storage/sdcard/qpython/scripts3/'
def main():
# Upload the application.
subprocess.call([ADB, '-d', 'push', APPLICATION, TARGET + APPLICATION])
# Launch the application.
subprocess.call('"%s" -d shell am 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 \
"%s%s"' % (ADB, TARGET, APPLICATION))
if __name__ == '__main__':
main()
test.py
contains:
from android import Android
import sl4a
droid = Android ()
droid.vibrate(1000)
There was same topic here 7 months ago, but there's no answers to that. Thanks in advance!
EDIT1: I've changed -e to -d as I have real device - now the script transferred to phone, but it isn't starting by itself.