@@ -19,7 +19,8 @@ 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
23
+ way to access it from Python. The schema for accessing to their API is::
23
24
24
25
[1] Cython -> [2] C JNI -> [3] Java
25
26
@@ -46,63 +47,93 @@ android
46
47
47
48
.. function :: check_pause()
48
49
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.
50
+ This should be called on a regular basis to check to see if Android
51
+ expects the game to pause. If it return true, the game should call
52
+ :func: `android.wait_for_resume() `, after persisting its state as necessary.
53
53
54
54
.. function :: wait_for_resume()
55
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.
56
+ This function should be called after :func: `android.check_pause() ` returns
57
+ true. It does not return until Android has resumed from the pause. While in
58
+ this function, Android may kill a game without further notice.
60
59
61
60
.. function :: map_key(keycode, keysym)
62
61
63
- This maps between an android keycode and a python keysym. The android
64
- keycodes are available as constants in the android module.
62
+ This maps between an android keycode and a python keysym. The android
63
+ keycodes are available as constants in the android module.
65
64
66
65
.. function :: vibrate(s)
67
66
68
- Causes the phone to vibrate for `s ` seconds. This requires that your
69
- application have the VIBRATE permission.
67
+ Causes the phone to vibrate for `s ` seconds. This requires that your
68
+ application have the VIBRATE permission.
70
69
71
70
.. function :: accelerometer_enable(enable)
72
71
73
- Enables (if `enable ` is true) or disables the device's accelerometer.
72
+ Enables (if `enable ` is true) or disables the device's accelerometer.
74
73
75
74
.. function :: accelerometer_reading()
76
75
77
- Returns an (x, y, z) tuple of floats that gives the accelerometer
78
- reading, in meters per second squared. See `this page
79
- <http://developer.android.com/reference/android/hardware/SensorEvent.html> `_
80
- for a description of the coordinate system. The accelerometer must
81
- be enabled before this function is called. If the tuple contains
82
- three zero values, the accelerometer is not enabled, not available,
83
- defective, has not returned a reading, or the device is in
84
- free-fall.
76
+ Returns an (x, y, z) tuple of floats that gives the accelerometer reading,
77
+ in meters per second squared. See `this page
78
+ <http://developer.android.com/reference/android/hardware/SensorEvent.html> `_
79
+ for a description of the coordinate system. The accelerometer must be
80
+ enabled before this function is called. If the tuple contains three zero
81
+ values, the accelerometer is not enabled, not available, defective, has not
82
+ returned a reading, or the device is in free-fall.
85
83
86
84
.. function :: get_dpi()
87
85
88
- Returns the screen density in dots per inch.
86
+ Returns the screen density in dots per inch.
89
87
90
88
.. function :: show_keyboard()
91
89
92
- Shows the soft keyboard.
90
+ Shows the soft keyboard.
93
91
94
92
.. function :: hide_keyboard()
95
93
96
- Hides the soft keyboard.
94
+ Hides the soft keyboard.
97
95
98
96
.. function :: wifi_scanner_enable()
99
97
100
- Enables wifi scanning. ACCESS_WIFI_STATE and CHANGE_WIFI_STATE permissions required.
98
+ Enables wifi scanning. ACCESS_WIFI_STATE and CHANGE_WIFI_STATE permissions
99
+ required.
101
100
102
101
.. function :: wifi_scan()
103
102
104
- Returns tuple of (SSID, BSSID, SignalLevel) for each visible WiFi access point.
103
+ Returns tuple of (SSID, BSSID, SignalLevel) for each visible WiFi access
104
+ point.
105
105
106
+ .. function :: action_send(mimetype, filename, subject, text, chooser_title)
107
+
108
+ Deliver data to someone else. This method is a wrapper around `ACTION_SEND
109
+ <http://developer.android.com/reference/android/content/Intent.html#ACTION_SEND> `_
110
+
111
+ :Parameters:
112
+ `mimetype `: str
113
+ Must be a valid mimetype, that represent the content to sent.
114
+ `filename `: str, default to None
115
+ (optional) Name of the file to attach. Must be a absolute path.
116
+ `subject `: str, default to None
117
+ (optional) Default subject
118
+ `text `: str, default to None
119
+ (optional) Content to send.
120
+ `chooser_title `: str, default to None
121
+ (optional) Title of the android chooser window, default to 'Send email...'
122
+
123
+ Sending a simple hello world text::
124
+
125
+ android.action_send('text/plain', text='Hello world',
126
+ subject='Test from python')
127
+
128
+ Sharing an image file::
129
+
130
+ # let's say you've make an image in /sdcard/image.png
131
+ android.action_send('image/png', filename='/sdcard/image.png')
132
+
133
+ Sharing an image with a default text too::
134
+
135
+ android.action_send('image/png', filename='/sdcard/image.png',
136
+ text='Hi,\n\tThis is my awesome image, what do you think about it ?')
106
137
107
138
android_mixer
108
139
~~~~~~~~~~~~~
0 commit comments