Android API

Using Botfather’s Android API any Android device connected to your PC can be automated. Also most Android emulators can be connected to Botfathe’r and automated. To do so Botfather makes use of the Android Debug Bridge (Adb for short). To use Botfather’s Android API one has to have Adb installed and eventually the Android developer options enabled on the connected Android device.

Table of contents

Android API methods


Android.connected();

Returns true if the Android device or emulator selected by the user is still connected to Adb server used by Botfather.

Android.listPackages();

Returns an array of strings containing all packages (including apps) installed on the connected Android device.

Android.startApp(package);

Starts the app identified by it’s package name. This method returns true if starting the app succeeded; returns false otherwise. Use the .listPackages method to check whether an app is installed on the users device.

Android.sendTap(location);

Sends an tap event to the specified location coordinates on the android devices screen. Returns true if sending the tap succeeded; returns false otherwise.

Android.sendSwipe(start, end, duration_in_ms);

Sends a swipe event from the start location to the end location. duration_in_ms specifies how long the swipe takes. Returns true if sending the swipe event succeeded; returns false otherwise.

Android.sendKeyEvent(key_event_code);

Sends the specified KeyEvent to the android device.

Returns on success, false otherwise.

Android.sendTextInput(text);

Sends the specified text in a text input event to the connected android device.

Returns on success, false otherwise.

Android.takeScreenshot();

Creates and returns an screenshot Image object.

Android.getSize();

Returns the Android devices screen size as a Size object.

Android.getRect();

Returns the Android devices screen size as a Rect object.