SL4A - Architecture
SL4A has three main components. They are as follows −
- Script Interpreters
- Android RPC Client
In this chapter, we will discuss more about these three components.
Each script runs in its own interpreter instance. Hence, multiple scripts can run simultaneously without affecting each other.
Android RPC Client
Scripts running within the interpreter instance communicates with the SL4A application through the Android Proxy RPC Client. The client establishes a Remote Procedure Call (RPC) connection to SL4A, and allows scripts to interact with the Android Framework. The SL4A facades facilitate this communication. Data is sent as JSON payloads.
Android RPC clients are provided for every supported scripting language. The client modules can be obtained from the SL4A website at https://code.google.com.
The façade simplifies the script’s access to the underlying Android API. SL4A exposes the Android Framework API to scripts through an extensive set of facades like AndroidFacade, BluetoothFacade, ActivityManagerFacade, CommonIntentsFacade, etc.
SL4A functionality offers a basket of rich functionalities like Camera, Location, Battery Manager, Media Player, Media Recorder and many more.
The SL4A system is suited for the following kinds of tasks −
RAD programming − With SL4A, it is possible to use Rapid Application Development (RAD) approach to create a prototype application quickly. You can create a full-blown Android application if the feasibility of the idea is confirmed.
Test scripts − It can be used to write test scripts.
Building Utilities − Utility scripts or tools that perform small tasks or automate certain aspects of repetitive tasks can be built using SL4A.