@@ -19,7 +19,8 @@ Example
1919How it's working
2020----------------
2121
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::
2324
2425 [1] Cython -> [2] C JNI -> [3] Java
2526
@@ -46,63 +47,93 @@ android
4647
4748.. function :: check_pause()
4849
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.
5353
5454.. function :: wait_for_resume()
5555
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.
6059
6160.. function :: map_key(keycode, keysym)
6261
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.
6564
6665.. function :: vibrate(s)
6766
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.
7069
7170.. function :: accelerometer_enable(enable)
7271
73- Enables (if `enable ` is true) or disables the device's accelerometer.
72+ Enables (if `enable ` is true) or disables the device's accelerometer.
7473
7574.. function :: accelerometer_reading()
7675
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.
8583
8684.. function :: get_dpi()
8785
88- Returns the screen density in dots per inch.
86+ Returns the screen density in dots per inch.
8987
9088.. function :: show_keyboard()
9189
92- Shows the soft keyboard.
90+ Shows the soft keyboard.
9391
9492.. function :: hide_keyboard()
9593
96- Hides the soft keyboard.
94+ Hides the soft keyboard.
9795
9896.. function :: wifi_scanner_enable()
9997
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.
101100
102101.. function :: wifi_scan()
103102
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.
105105
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 ?')
106137
107138android_mixer
108139~~~~~~~~~~~~~
0 commit comments