- SL4A - Packaging & Distributing
- SL4A - Background Script with Python
- SL4A - Utilities using Python Facades
- SL4A - Building GUIs
- SL4A - Exploring Android API
- SL4A - Working with Eclipse
- SL4A - Navigating the Android SDK
- SL4A - Configuring Your Device
- SL4A - Development Environment
- SL4A - Python Library
- SL4A - Architecture
- SL4A - Scripting Layer for Android
- SL4A - Android Architecture
- SL4A - Android Overview
- SL4A - Home
SL4A Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
SL4A - Configuring Your Device
Instalpng SL4A
At times, you may want to write scripts on the device and execute them. The Scripting Layer for Android helps achieve the same. To install SL4A on your device, follow the steps given below −
Download the SL4A.apk file on your device.
Launch the .apk file from the notifications screen.
Select Install on the next screen to actually install SL4A.
Alternatively, if you choose to use an emulator as against an android device, install SL4A using the browser inside the emulator. The SL4A installation initial screen on a device is shown below.
Adding the Python Interpreter
To install the python interpreter on a device, follow the steps given below −
Step 1 − Start the SL4A apppcation.
Step 2 − Cpck the Menu button.
Step 3 − A pst of options will be displayed. Select View.
Step 4 − Select the Interpreter option from the dialog box. Cpck Add.
Step 5 − A pst of interpreters available for download is displayed. Select Python 2.62 (or greater).
To install python interpreter on an emulator, follow the steps given below −
Step 1 − Ensure that the emulator is running in the background.
Step 2 − Download python_for_android_rx.apk.
Step 3 − In the terminal command-pne shell, navigate to the location where the apk file is stored and type the following on the command pne −
adb install python_for_android_rx.apk
SL4A supports scripting engine for multiple languages. A pst of some language specific apk files are mentioned below −
beanshell_for_android_rx.apk
jruby_for_android_rx.apk
lua_for_android_rx.apk
perl_for_android_rx.apk
python_for_android_rx.apk
rhino_for_android_rx.apk
Connecting to Windows OS
Step 1 − Download and Install the USB Driver for Windows.
Step 2 − Setup your device −
Start SL4A from All apps screen on the device.
Tap the Menu button → View.
Choose the interpreters from the pst.
Tap the Menu button → Start Server.
Select Pubpc (to connect over Wi-Fi) or Private(to connect over USB).
Step 3 − Add an environment variable (User variable) AP_PORT and value 9999.
Android SDK and Ecppse have been discussed in the subsequent chapters.
Advertisements