Android-ElectricSheep-Automator
view release on metacpan or search on metacpan
install_app($params)
It installs the app from its specified APK (bytecode archive and more)
file.
$params is a HASH_REF which should contain:
* apk-filename
The APK filename to install onto the device. It must exist locally,
obviously.
* install-parameters
Optional parameters to be passed on to the adb install command.
Nothing is expected here. Refer to the adb documentation
<https://developer.android.com/tools/adb> for what parameters are
supported. For example, -r is for re-installation of an existing app
and retaining its previous data.
It returns 1 on failure. It returns 0 on success.
Note that there is a script available which utilises this method, see
electric-sheep-install-app.pl.
is_app_running($params)
It checks if the specified app is running on the device. The name of
the app must be exact. Note that you can search for running apps /
commands with extended regular expressions using L/pgrep()>
$params is a HASH_REF which should contain:
* appname
the name of the app to check if it is running. It must be its exact
name. Basically it checks the output of pidof().
It returns undef on failure, 1 if the app is running or 0 if the app is
not running.
find_current_device_properties($params)
It enquires the device currently connected, and specified with
"connect_device($params)", if needed, and returns back an
Android::ElectricSheep::Automator::DeviceProperties object containing
this information, for example screen size, resolution, serial number,
etc.
It returns Android::ElectricSheep::Automator::DeviceProperties object
on success or undef on failure.
connect_device()
It signals to our object that there is now a device connected to the
desktop and its enquiry and subsequent control can commence. If this is
not called and neither device-is-connected => 1 is specified as a
parameter to the constructor, then the functionality will be limited
and access to functions like "swipe($params)", "open_app($params)",
etc. will be blocked until the caller signals that a device is now
connected to the desktop.
Using "connect_device($params)" to specify which device to target in
the case of multiple devices connected to the desktop will also call
this method.
This method will try to enquire the connected device about some of its
properties, like screen size, resolution, orientation, serial number
etc. This information will subsequently be available via
$self->device_properties()>.
It returns 0 on success, 1 on failure.
disconnect_device()
Signals to our object that it should consider that there is currently
no device connected to the desktop (irrespective of that is true or
not) which will block access to "swipe($params)", "open_app($params)",
etc.
device_properties()
It returns the currently connected device properties as a
Android::ElectricSheep::Automator::DeviceProperties object or undef if
there is no connected device. The returned object is constructed during
a call to "find_current_device_properties($params)" which is called via
"connect_device($params)" and will persist for the duration of the
connection. However, after a call to "disconnect_device()" this object
will be discarded and undef will be returned.
swipe($params)
Emulates a "swipe" in four directions. Sets the current Android device
to control. It is only required if you have more than one device
connected. $params is a HASH_REF which may or should contain:
* direction
should be one of
up
down
left
right
* dt
denotes the time taken for the swipe in milliseconds. The smaller its
value the faster the swipe. A value of 100 is fast enough to swipe to
the next screen.
It returns 0 on success, 1 on failure.
tap($params)
Emulates a "tap" at the specified location. $params is a HASH_REF which
must contain one of the following items:
( run in 0.676 second using v1.01-cache-2.11-cpan-39bf76dae61 )