adbkat reduces the amount of code needed to use adbkit by exposing a Device object that interacts with a specific device over a specific client connection.
- Node.js >= 6.4.0
- Android SDK Platform-tools ^24.0.1 with the
adb
command included on the system path.
npm install adbkat
Before submitting a pull request, make sure that you...
- Write/edit documentation for all new/modified members that are exposed by a module.
- If any documentation was written/edited, run
npm run jsdoc
to update the documentation in this README.md. - Write unit tests for all new sufficiently significant functions. If a function has a name or is exposed by a module, then it is significant enough that it should be tested.
- Run all unit tests with
npm test
and correct all failures. - Run ESLint with
npm run lint
and correct all warnings and errors.
- adbkat
Encapsulates adbkit's client and device within a common structure.
- Device
A device that can be communicated with via ADB.
Encapsulates adbkit's client and device within a common structure.
Retrieves the Devices that represent the devices that are connected to the computer via ADB.
Kind: static method of adbkat
Returns: Promise.<Array.<Device>>
- A promise that resolves with the devices that
are connected to the computer via ADB.
A device that can be communicated with via ADB.
Kind: global class
- Device
- .getPhoneNumber() ⇒
Promise.<String>
- .install(apk) ⇒
Promise.<Boolean>
- .shell(command) ⇒
Promise.<String>
- .uninstall(pkg) ⇒
Promise.<Boolean>
- .getPhoneNumber() ⇒
Retrieves the phone number of the device.
This function uses dumpstate, which may not be a reliable method of retrieving the phone number, depending on your device model. For that reason this function should be considered experimental, and should only be used if you know that dumpstate can be used to retrieve your device's phone number.
Note that the promise will take a few minutes to resolve, due to the size of dumpstate's output.
Kind: instance method of Device
Returns: Promise.<String>
- A promise that resolves with the device's
phone number.
Installs the specified apk file onto the device.
Kind: instance method of Device
Returns: Promise.<Boolean>
- A promise that resolves with true when the app
is successfully installed.
Param | Type | Description |
---|---|---|
apk | String | Stream |
The apk file to install. See adbkit.Client.install. |
Runs the specified shell command on the device. See the official ADB shell documentation for valid commands.
Kind: instance method of Device
Returns: Promise.<String>
- A promise that resolves with the string output
of the command when the command finishes.
Param | Type | Description |
---|---|---|
command | String |
The command to run. |
Uninstalls the specified package from the device.
Kind: instance method of Device
Returns: Promise.<Boolean>
- A promise that resolves with true when the
package is finished uninstalling.
Param | Type | Description |
---|---|---|
pkg | String |
The name of the package to uninstall. |