Skip to content

Commit 6a72910

Browse files
committed
add explaination about android module
1 parent 0a4ed57 commit 6a72910

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

docs/source/android.rst

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
Android Python module
2+
=====================
3+
4+
Python for android project include a python module named "android". This module is designed to give you an access to the Android API. As for today, the module is very limited, and waiting for contribution to wrap more Android API.
5+
6+
Example
7+
-------
8+
9+
::
10+
11+
import android
12+
13+
# activate the vibrator
14+
android.vibrate(1)
15+
16+
# read screen dpi
17+
print android.get_dpi()
18+
19+
How it's working
20+
----------------
21+
22+
The whole Android API is accessible in Java. Their is no native or extensible way to access it from Python. The schema for accessing to their API is:
23+
24+
[1] Cython -> [2] C JNI -> [3] Java
25+
26+
#. The ``android.pyx`` is written in Cython: a language with typed informations, very close to Python, that generate Python extension. It's easier to write in Cython than CPython, and it's linked directly to the part 2.
27+
#. The second part define simple c methods that access to Java interfaces through JNI in the file ``android_jni.c``.
28+
#. The last part contain the Java code that will be called from the JNI stuff.
29+
30+
All the source code is available at:
31+
32+
https://github.com/kivy/python-for-android/tree/master/recipes/android/src
33+
34+
35+
API
36+
---
37+
38+
TODO

docs/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ your application.
2323
howitworks.rst
2424
customize.rst
2525
recipes.rst
26+
android.rst
2627
related.rst
2728

2829
Indices and tables

0 commit comments

Comments
 (0)