Sunday, April 24, 2011

Python development using Scripting Layer for Android (SL4A)

By Vasudev Ram -

Looking to get into Android programming? Android smartphones sales have been exploding for a while, and most industry predictions say that this will continue for some years. An oft-quoted statistic: the number of Android devices shipping *daily* is in the range of 300,000 to 350,000. Just a few weeks / months earlier that number was 200,000 per day. So the number per day is high, and that number is also increasing.

The main Android development environment is Java. But using the Scripting Layer for Android (SL4A), it's possible to program at least some apps (*) using Python or other environments / languages such as Perl, JRuby, Lua, BeanShell, JavaScript and Tcl. Apart from using the SL4A to write apps that are possible using it, another use of it can be to quickly prototype part or all of a new app with it, and then rewrite it in Java after validating any necessary assumptions.

(*) One reason why it is not possible to program all possible Android apps using SL4A, is that it only exposes a subset of Android APIs.

This Linux Journal article I saw today, gives an introduction to programming on Android using Python with the SL4A. It shows how to set up the necessary software (both on your PC and on your Android phone), and gives a couple of example Python programs that you can create on your PC (Windows, Linux or Mac OS X) and then transfer to and run on your Android phone. Here is the article link:

Python for Android:

Posted via email
- Vasudev Ram
Dancing Bison Enterprises


Navin said...

SL4A is also a great way to write python scripts on your desktop/laptop PC with which to control your phone.

For example I read and write SMSs using SL4A powered python scripts on my Linux laptop, and I find it much nicer and more usable than using my phone itself :-)

Vasudev Ram said...

>SL4A is also a great way to write python scripts on your desktop/laptop PC with which to ...

Thanks for the info; I'll check that out.