News for hackers. Stuff that matters.
Re:Python for Android by jventura on Monday March 27, 2017 @04:12AM (#13965947)
Some years ago I tried to use python-for-android, but found it too much of a burden to do what I wanted, which was just to simply integrate existing python code in native android apps (with Java). Don't know how much has changed since then, but python-for-android's bootstrap used pygame and pysdl to start an opengl scene, where you would have completely non-native widgets.

I rolled my own solution [0] which uses crystax distribution's of CPython for android (Python 3.5), and I did a very simple JNI bridge between java and cpython using an RPC-like mechanism over json. Basically, on the java side you call a function and pass the arguments [1], and on the python side you "route" it to your own functions [2]. I think all pybridge's code is very very simple for those who understand a bit of Java, a bit of C and a bit of Python, and I explain in the readme how everything works, including which classes/files are relevant.

I have an app where I use this [3], and although it hasn't earn me much money so far (~20 downloads, 110€), it is rated 4.7 in the play store, so the performance of accessing python functions on android is not bad at all..

[0] https://github.com/joaoventura/pybridge

[1] https://goo.gl/sw4JLt

[2] https://goo.gl/17SlVb

[3] https://play.google.com/store/apps/details?id=com.flatangle....

Re:Python for Android by inclemnet on Monday March 27, 2017 @06:21AM (#13966426)
We've actually completely rewritten python-for-android since then, it now supports multiple bootstraps and is not tied to Kivy at all, and it should be relatively easy to use the python distribution in a native app (although this could be streamlined).

CrystaX's support is great though, and actually python-for-android uses this for Python 3 builds.

Re:Python for Android by on_and_off on Monday March 27, 2017 @12:53PM (#13969385)
I looked at the app, as far as I can tell, it seems fairly basic.

Why use python for this ?

Re:Python for Android by jventura on Monday March 27, 2017 @01:45PM (#13969972)
Because I already had a lot of code doing a lot of things in Python (https://github.com/flatangle/flatlib/)..