API Introduction

This section introduces basic API usage, allowing you to learn another way to use FIRERPA.

FIRERPA provides up to 160 programmatic API interfaces, enabling you to manage and operate Android devices with meticulous detail, including command execution, system settings, system status, application-related operations, automation, proxies, files, and more than a dozen other categories. A well-packaged Python library is provided to help you get started quickly. Before beginning, please ensure that the FIRERPA server is running normally on your phone and that you have installed the FIRERPA client library lamda as required.

Tip

Don't worry if you can't write or understand the code – use the Agent Skills we provide github.com/firerpa/skills to automatically develop with large models.

Hint

Many API methods provided by the FIRERPA Python client library return native proto classes. You can directly access field values via the properties of the output result, or check the proto definitions in the rpc directory to see which attributes are available in different results. For example, if a method returns the following result, you can directly access specific fields as shown.

>>> result = status.get_battery_info()
>>> print (result)
batt_charging: true
batt_percent: 100
batt_temperature: 26.899999618530273
>>> print (result.batt_temperature)
26.899999618530273

Connecting to a Device

Before connecting to a device, you need to prepare some necessary information, such as the IP address that can reach your phone, and whether you used a server certificate when starting FIRERPA. Once you have this information ready, you can proceed with the steps below.

Instantiate the device; by default you only need to provide an accessible IP address.

from lamda.client import *
d = Device("192.168.0.2")

If you enabled the server certificate or need to change the port when starting the FIRERPA server, connect like this.

from lamda.client import *
d = Device("192.168.0.2", certificate="/path/to/lamda.pem", port=65000)

From now on, the variable d in the following text will always refer to this Device instance.

Simple Warm-up

Now, execute the following code – it will launch the Settings app for you.

d.application('com.android.settings').start()

You can also use the following method to make the device beep. This is very convenient for locating it when you have multiple devices.

d.beep()

Alright, now you have understood the basic usage. Continue reading to learn about other available interfaces.