You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/android.rst
+113-4Lines changed: 113 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -19,12 +19,16 @@ Example
19
19
How it's working
20
20
----------------
21
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:
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
23
24
24
[1] Cython -> [2] C JNI -> [3] Java
25
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``.
26
+
#. ``android.pyx`` is written in `Cython <http://cython.org/>`_: a language
27
+
with typed informations, very close to Python, that generate Python
28
+
extension. It's easier to write in Cython than CPython, and it's linked
29
+
directly to the part 2.
30
+
#. ``android_jni.c`` is defining simple c methods that access to Java
31
+
interfaces using JNI layer.
28
32
#. The last part contain the Java code that will be called from the JNI stuff.
29
33
30
34
All the source code is available at:
@@ -35,4 +39,109 @@ All the source code is available at:
35
39
API
36
40
---
37
41
38
-
TODO
42
+
android
43
+
~~~~~~~
44
+
45
+
.. module:: android
46
+
47
+
.. function:: check_pause()
48
+
49
+
This should be called on a regular basis to check to see if Android
50
+
expects the game to pause. If it return true, the game should
51
+
call :func:`android.wait_for_resume()`, after persisting its state
52
+
as necessary.
53
+
54
+
.. function:: wait_for_resume()
55
+
56
+
This function should be called after :func:`android.check_pause()`
57
+
returns true. It does not return until Android has resumed from
58
+
the pause. While in this function, Android may kill a game
59
+
without further notice.
60
+
61
+
.. function:: map_key(keycode, keysym)
62
+
63
+
This maps between an android keycode and a python keysym. The android
64
+
keycodes are available as constants in the android module.
65
+
66
+
.. function:: vibrate(s)
67
+
68
+
Causes the phone to vibrate for `s` seconds. This requires that your
69
+
application have the VIBRATE permission.
70
+
71
+
.. function:: accelerometer_enable(enable)
72
+
73
+
Enables (if `enable` is true) or disables the device's accelerometer.
74
+
75
+
.. function:: accelerometer_reading()
76
+
77
+
Returns an (x, y, z) tuple of floats that gives the accelerometer
78
+
reading, in meters per second squared. See `this page
0 commit comments