Android, Python e remote development
Gli step da seguire sono quelli di questa pagina.
In case you have a vanilla phone like I do, you will need to follow these steps:
- download and install the Android SDK for your platform
- add the SDK tools to your system path, for instance on Windows run this in a shell:
> set PATH=%PATH%;path_to_android_sdk\tools
- activate USB debugging on your phone (Parameters > Applications > Development > USB Debugging)
- setup your system to detect your device as explained here (on Windows, it means installing the usb driver from the SDK)
- check that your phone is detected correctly by running adb get-state (if everything is ok, the result should be ‘device’)
- check out the Android Scripting Environment svn repository on your computer (see this page)
Your system is almost configured, let’s install the necessary applications on the phone:
- install the Android Scripting Environment on your phone
- (optionally) install the Text-to-Speech library (by Charles Chen) on your phone if you want to use it in your scripts, via the Android Market
- run ASE on your phone, type menu and start a Python shell, you will notice a line like ‘export AP_PORT = “49508″‘.
- setup port forwarding on your system with the value you just noted:
> set AP_PORT=49508
> adb forward tcp:%AP_PORT% tcp:%AP_PORT%
- go to the ASE directory on your computer containing the android.py module
> cd path_to_ASE\python\ase
- run your favorite Python 2.6 interpreter and enjoy the magic:
Riassumendo:
- installare Python 2.6 perchè 2.5 non supporta nativamente json (e tutto gira intorno a json)
- scaricare ASE sul cellulare
- script e inteprete python sul cellulare
- l’SDK di Android sul PC
- TUTTO il pacchetto python di ASE sul PC
L’ultimo task si esegue installando Mercurial e facendo un clone del progetto sul PC (occhio che tutto il progetto occupa 273 MB)
Questo è ottimisticamente solo un inizio. Spero che in futuro realizzino un apk intelligente per Android e una documentazione delle API ASE più seria
Qualche link