File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ PythonHere
2727- *Here * is a server part with the GUI interface. It could be Android, Raspberry Pi, some other remote device that being debugged.
2828- And *%there * is a client - Jupyter magic command to run code interactively on remote device.
2929
30+ Project documentation: https://herethere.me
3031
3132.. |jupyter | image :: https://raw.githubusercontent.com/b3b/pythonhere/master/docs/left_jupyter.png
3233 :align: middle
@@ -44,8 +45,6 @@ PythonHere
4445 * - |jupyter |
4546 - |android |
4647
47- Project documentation: https://herethere.me
48-
4948
5049Install on Android
5150------------------
Original file line number Diff line number Diff line change 1+ ---
2+ jupyter :
3+ jupytext :
4+ text_representation :
5+ extension : .md
6+ format_name : markdown
7+ format_version : ' 1.2'
8+ jupytext_version : 1.7.1
9+ kernelspec :
10+ display_name : Python 3
11+ language : python
12+ name : python3
13+ ---
14+
15+ # Android functions
16+ Android platform features could be used with [ PyJNIus] ( https://github.com/kivy/pyjnius ) and [ Plyer] ( https://github.com/kivy/plyer ) libraries.
17+
18+ ``` python
19+ % load_ext pythonhere
20+ % connect- there
21+ ```
22+
23+ ## Send SMS
24+
25+
26+ ### Request SEND_SMS runtime permission
27+
28+ ``` python
29+ % there - bl 1 log
30+ ```
31+
32+ ``` python
33+ %% there
34+ from kivy.logger import Logger
35+ from android.permissions import Permission, check_permission, request_permission
36+
37+ def permissions_callback (permissions , grant_results ):
38+ if permissions and all (grant_results):
39+ Logger.info(" Runtime permissions: granted" )
40+ else :
41+ Logger.error(" Runtime permissions: not granted" )
42+
43+ permission = Permission.SEND_SMS
44+ if check_permission(permission):
45+ print (f " { permission} is already granted " )
46+ else :
47+ request_permission(permission, callback = permissions_callback)
48+ ```
49+
50+ ### Send message with Plyer
51+
52+ ``` python
53+ %% there
54+ import plyer
55+ plyer.sms.send(recipient = " " , message = " Hey!" )
56+ ```
You can’t perform that action at this time.
0 commit comments