The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Android::ADB - thin wrapper over the 'adb' command

SYNOPSIS

  use Android::ADB;;
  my $adb = Android::ADB->new(path => '/opt/android/platform-tools/adb');
  my @devices = $adb->devices;
  $adb->set_device($devices[0]);
  $adb->push('file.txt', '/sdcard/');
  sleep 10;
  $adb->reboot('recovery');

DESCRIPTION

This module is a minimal wrapper over the Android Debug Bridge (adb) command for manipulating Android devices.

Methods die on non-zero exit code and return the text printed by the adb command. The available methods are:

Android::ADB->new([args])

Create a new Android::ADB object. The available arguments are path, the path to the adb executable (defaults to the value of the environment variable ADB or the string adb) and args, an arrayref of arguments passed to every adb command (defaults to []).

$adb->devices

Returns a list of Android::ADB::Device objects representing connected devices.

$adb->set_device($device)

Takes an Android::ADB::Device and directs all further commands to that device by passing -s serialno to every command.

$adb->run($command, [@args])

Run an arbitrary ADB command and return its output.

$adb->start_server
$adb->kill_server
$adb->connect($host_and_port)
$adb->disconnect([$host_and_port])
$adb->wait_for_device
$adb->get_state
$adb->get_serialno
$adb->get_devpath
$adb->remount
$adb->reboot([$where])
$adb->reboot_bootloader
$adb->root
$adb->usb
$adb->tcpip($port)
$adb->push($local, $remote)
$adb->pull($remote, $local)
$adb->shell(@args)

Analogues of the respective adb commands.

$adb->pull_archive($remote, $local)

Same as adb pull -a $remote $local.

AUTHOR

Marius Gavrilescu, <marius@ieval.ro>

COPYRIGHT AND LICENSE

Copyright (C) 2017 by Marius Gavrilescu

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.24.2 or, at your option, any later version of Perl 5 you may have available.