# adbjs

> Call adb methods from node

Latest version **0.2.6** (published 2016-03-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install adbjs
pnpm add adbjs
yarn add adbjs
bun add adbjs
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.6 |
| Published | 2016-03-06 |
| First published | 2015-05-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Urucas |
| Maintainers | urucas, vrunoa |
| Keywords | adb, android, node, javascript, js |

## Links

- npm: https://www.npmjs.com/package/adbjs
- Repository: https://github.com/Urucas/adbjs
- Issues: https://github.com/Urucas/adbjs/issues
- npm.io page: https://npm.io/package/adbjs

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.2.6 (latest) — 2016-03-06
- 0.2.5 — 2016-03-04
- 0.2.4 — 2016-03-03
- 0.2.3 — 2016-03-02
- 0.2.2 — 2015-10-28
- 0.2.1 — 2015-10-21
- 0.2.0 — 2015-10-21
- 0.1.9 — 2015-07-13
- 0.1.7 — 2015-07-07
- 0.1.6 — 2015-07-07
- 0.1.5 — 2015-07-07
- 0.1.4 — 2015-07-06
- 0.1.3 — 2015-07-01
- 0.1.2 — 2015-06-30
- 0.1.1 — 2015-06-30
- … 9 more at https://npm.io/package/adbjs/versions

## README

# adbjs [![Build Status](https://travis-ci.org/Urucas/adbjs.svg)](https://travis-ci.org/Urucas/adbjs)
Use adb from node

#Requirements
* ADB

#Install
```bash
npm install --save adbjs
```

#Build
```bash
git clone https://github.com/Urucas/adbjs.git
npm run build
```

#Usage
```javascript
import ADB from 'adbjs'
let adb = new ADB()

// Getting adb version
let version = adb.version()
console.log(version)
// Android Debug Bridge version 1.0.32

// Getting devices
let devices = adb.devices()
console.log(devices)
// [ '07042e0e13cca2d0' ]

let deviceInfo = adb.deviceInfo(devices[0])
console.log(deviceInfo)
// { id: '07042e0e13cca2d0', model: 'Nexus 5', version: '5.1.1' }

// select device
adb.selectDevice(devices[0])

// check if device is available
let isAvailable = adb.isDeviceAvailable('07042e0e13cca2d0')
console.log(isAvailable)
// true

// list installed packages
let packages = adb.listPackages()
/* 
 * [ 'com.skype.raider',
 *   'com.google.android.youtube',
 *   'com.android.providers.telephony',
 *   'com.google.android.gallery3d',
 *   ...
 *   'com.google.android.inputmethod.latin' ]
*/ 

// check if a package is installed
let isInstalled = adb.isPackageInstalled("com.urucas.zoster_testpp")
console.log(isInstalled)
// false

// check if package is currently running
let isRunning = adb.isAppRunning("com.google.android.youtube")
console.log(isRunning)
// true 

// close a application running
adb.closeApp("com.google.android.youtube")

// install a package
adb.install("/path/to/my/zoster_testapp.apk", "com.urucas.zoster_testapp")

// get wlan0 ip
let ip = adb.getDeviceWlan0()
console.log(ip)
// 192.168.0.105

// connect a device via tcpip
let conn = adb.tcpConnect()
console.log(conn)
// 192.168.0.105:5555

// disconnect device
adb.tcpDisconnect(conn)

// lock device
adb.lock()

// unlock device
adb.unlock()

// get information about the power display
let power = adb.power()
console.log(power)
// { display_power: 'ON', "battery_level": 93 }

```
# Monitor
Using adbjs to monitor a device changes

``` node
let monitor = adb.monitor()
// emits an event on battery change
monitor.on("battery", (power) => {
  // { display_power: 'ON', "battery_level": 93 }
  // { display_power: 'ON', "battery_level": 92 }
  
  // you may integrate this monitor to slack, 
  // so if battery is to low send a notification
  // { display_power: 'ON', "battery_level": 5 }
})

// emits an event on display changes [ON|OFF]
monitor.on("display", (power) => {
  // { display_power: 'ON', "battery_level": 93 }
  // { display_power: 'OFF', "battery_level": 93 }
})
```

---
_Source: https://npm.io/package/adbjs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
