Honey, There is a Python in my Android Phone!
Simple scripting, such as Python, Bash, PHP, Perl are all embedded in modern operating system. Since Android is also a linux-based operating system, with some techniques, it is also possible for us to write a script. Unfortunately before SL4A arrives (Scripting Language 4 Android), it is not possible for us to script on Android phone. SL4A provides rich APIs that allow user to access Android intents such as GPS location, Accelerometer, Camera, Battery status, and etc. through scripting. Hence with the rich APIs, the user can build a very simple script to interact with those APIs, without building a complex app.
This talks shows how we can interact with android intents and APIs via RPC using python client embedded inside the android app, through SL4A app. First the speaker introduces various python related apps available for android OS. Next the speaker will show the relationship and interaction between Android API and Python API inside SL4A, and how RPC is used as communication between two APIs, hence demonstrate how a new different service/intent can be built based on the provided Android API, by doing some hacking on Python API inside SL4A.
The speaker will begin his talk with introduction on the basic of RPC, and illustrate the relationship between Android APIs and Python APIs in SL4A, by comparing both Android and Python code. The speaker will then demonstrate how different android intents can be accessed on the android devices, through various demo, such as reading GPS coordinate and x, y, z position from the accelerometer, together with making a phone call through python client on android phone. In the end, the speaker will demonstrate how a flask application that allows user to send SMS messages through Rest APIs, can be built on top on the android.
Ing Wei is the co-chair of PyCon MY and vice president of MyPOP, as well as an automation engineer in an insurance company. He has spoken in various PyCons, particularly in PyCon APAC 2017, as well as involving in PyCon communities.
He uses python a lot in his daily work, especially coding the automation process and flow. During his past time, he likes to experience and perform hacking different things on operating system level.