[Mobile-sig] support of the android platform

Xavier de Gaye xdegaye at gmail.com
Thu Apr 28 05:09:52 EDT 2016


On 04/28/2016 03:01 AM, Russell Keith-Magee wrote:
 > (Apologies for the personal repost - I forgot to reply-all on the first attempt)
 >
 > Hi Xavier,
 >
 > Great stuff!
 >
 > I’ve got a question about your experience integrating with the native Android platform APIs.
 >
 > Getting CPython compiled as a native binary library is a huge step, but my experience has been that bridging between binary libraries and the Java/Dalvik APIs is a painful process - JNI *exists*, but
 > it’s *really* slow, and has some pretty harsh limitations (like the kernel-imposed JNI reference count limit).
 >
 > For some applications, this won’t matter - for example, if you’re treating the android device as a low power server, something that is terminal only isn’t a problem. However, if you want to write a
 > native app, then you need to be able to create an Activity, with a View, put a Button on it, and a Layout, and so on. Have you done any exploration of the binding to these native APIs?


A first-class citizen java application embeds python using JNI. The embedded
python accesses the android API by importing and invoking methods of an
android.py module.  The android.py module maps those API requests to json RPC
calls that are sent to another java application so that they may be processed
and their results returned.  This is the design of Scripting Layer for Android
(SL4A) [1], a languishing project.

IMHO you should define what 'slow' means, slow for a gaming application, for
tracking the smartphone accelerometer or for a pyephem based application that
brings the ephemeresis of stars and planets at your finger tip :)

Xavier

[1] https://github.com/damonkohler/sl4a



More information about the Mobile-sig mailing list