Device API
DeviceAPI is a collection of ruby gems that make working with physical devices
easy and consistent. DeviceAPI provides common utilities such as device
detection and identification, and useful helpers for installing applications
and identifying problems with devices.
We use DeviceAPI heavily to leverage devices in Hive CI. It's also used by
our test developers in their test code. It's our interface to the devices we
test against and is where we put all common code for interacting with our
physical devices. It also provides an abstraction so we can deal with devices
interchangeably.
DeviceAPI-Android
DeviceAPI-Android is the DeviceAPI implementation for Android devices. It
uses the command line tools
for interacting with connected devices:
device = DeviceAPI::Android.devices.first
device.model #=> 'samsung gt-i9100'
device.orientation #=> :portrait
device.install('path/to/build.apk') #=> true
In addition to detecting and identifying physical devices, DeviceAPI-Android
handles functions like:
- managing keystores and signing apps
- installing and deleting applications
- managing orientation and settings
- capturing screenshots
- performing cleanup operations
- executing monkey testing
DeviceAPI-IOS
DeviceAPI-IOS is the iOS implementation of DeviceAPI. It uses
for interacting with
connected devices.
This gem offers most of the same features as the Android version. The API
is identical where possible:
device = DeviceAPI::IOS.devices.first
device.model #=> 'iPad mini 3'