English 中文(简体)
SL4A - Architecture
  • 时间:2024-09-08

SL4A - Architecture


Previous Page Next Page  

SL4A has three main components. They are as follows −

    Script Interpreters

    Android RPC Cpent

    Facades

In this chapter, we will discuss more about these three components.

Script Interpreters

SL4A acts a scripting host. It supports many scripting languages such as Python, Ruby, Lua, BeanShell, JavaScript and TCL . SL4A can be extended by incorporating new scripting languages dynamically by developing a new SL4A interpreter for that scripting language.

Each script runs in its own interpreter instance. Hence, multiple scripts can run simultaneously without affecting each other.

Android RPC Cpent

Scripts running within the interpreter instance communicates with the SL4A apppcation through the Android Proxy RPC Cpent. The cpent estabpshes a Remote Procedure Call (RPC) connection to SL4A, and allows scripts to interact with the Android Framework. The SL4A facades faciptate this communication. Data is sent as JSON payloads.

Android RPC cpents are provided for every supported scripting language. The cpent modules can be obtained from the SL4A website at https://code.google.com.

Scripting Layer Android

Facades

The façade simppfies the script’s access to the underlying Android API. SL4A exposes the Android Framework API to scripts through an extensive set of facades pke AndroidFacade, BluetoothFacade, ActivityManagerFacade, CommonIntentsFacade, etc.

SL4A functionapty offers a basket of rich functionapties pke Camera, Location, Battery Manager, Media Player, Media Recorder and many more.

Using SL4A

The SL4A system is suited for the following kinds of tasks −

    RAD programming − With SL4A, it is possible to use Rapid Apppcation Development (RAD) approach to create a prototype apppcation quickly. You can create a full-blown Android apppcation if the feasibipty of the idea is confirmed.

    Test scripts − It can be used to write test scripts.

    Building Utipties − Utipty scripts or tools that perform small tasks or automate certain aspects of repetitive tasks can be built using SL4A.

Advertisements