androidtv.adb_manager module

Classes to manage ADB connections.

  • ADBPython utilizes a Python implementation of the ADB protocol.

  • ADBServer utilizes an ADB server to communicate with the device.

class androidtv.adb_manager.ADBPython(host, adbkey='')[source]

Bases: object

A manager for ADB connections that uses a Python implementation of the ADB protocol.

Parameters
  • host (str) – The address of the device in the format <ip address>:<host>

  • adbkey (str) – The path to the adbkey file for ADB authentication

property available

Check whether the ADB connection is intact.

Returns

Whether or not the ADB connection is intact

Return type

bool

close()[source]

Close the ADB socket connection.

connect(always_log_errors=True, auth_timeout_s=0.1)[source]

Connect to an Android TV / Fire TV device.

Parameters
  • always_log_errors (bool) – If True, errors will always be logged; otherwise, errors will only be logged on the first failed reconnect attempt

  • auth_timeout_s (float) – Authentication timeout (in seconds)

Returns

Whether or not the connection was successfully established and the device is available

Return type

bool

shell(cmd)[source]

Send an ADB command using the Python ADB implementation.

Parameters

cmd (str) – The ADB command to be sent

Returns

The response from the device, if there is a response

Return type

str, None

class androidtv.adb_manager.ADBServer(host, adb_server_ip='', adb_server_port=5037)[source]

Bases: object

A manager for ADB connections that uses an ADB server.

Parameters
  • host (str) – The address of the device in the format <ip address>:<host>

  • adbkey (str) – The path to the adbkey file for ADB authentication

  • adb_server_ip (str) – The IP address of the ADB server

  • adb_server_port (int) – The port for the ADB server

property available

Check whether the ADB connection is intact.

Returns

Whether or not the ADB connection is intact

Return type

bool

close()[source]

Close the ADB server socket connection.

Currently, this doesn’t do anything.

connect(always_log_errors=True)[source]

Connect to an Android TV / Fire TV device.

Parameters

always_log_errors (bool) – If True, errors will always be logged; otherwise, errors will only be logged on the first failed reconnect attempt

Returns

Whether or not the connection was successfully established and the device is available

Return type

bool

shell(cmd)[source]

Send an ADB command using an ADB server.

Parameters

cmd (str) – The ADB command to be sent

Returns

The response from the device, if there is a response

Return type

str, None

androidtv.adb_manager.LOCK_KWARGS = {'timeout': 3}

Use a timeout for the ADB threading lock if it is supported