# adb-commander

> A typescript project

Latest version **0.1.9** (published 2020-05-27) · 0 weekly downloads

## Install

```sh
npm install adb-commander
pnpm add adb-commander
yarn add adb-commander
bun add adb-commander
```

## 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.1.9 |
| Published | 2020-05-27 |
| First published | 2018-09-13 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 10.4 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | gengjiawen |
| Maintainers | susanpan |

## Links

- npm: https://www.npmjs.com/package/adb-commander
- npm.io page: https://npm.io/package/adb-commander

## Dependencies (1)

- [adb-driver](https://npm.io/package/adb-driver.md) ^0.1.8

## Recent versions

- 0.1.9 (latest) — 2020-05-27
- 0.1.8 — 2019-02-25
- 0.1.7 — 2019-02-20
- 0.1.6 — 2019-02-20
- 0.1.5 — 2019-02-20
- 0.1.4 — 2019-02-20
- 0.1.3 — 2019-02-20
- 0.1.2 — 2019-02-19
- 0.1.1 — 2019-02-19
- 0.1.0 — 2019-02-19
- 0.0.15 — 2019-01-22
- 0.0.14 — 2019-01-22
- 0.0.13 — 2019-01-22
- 0.0.12 — 2019-01-15
- 0.0.11 — 2019-01-15
- … 9 more at https://npm.io/package/adb-commander/versions

## README

# adb-commander

[![tested with jest](https://img.shields.io/badge/tested_with-jest-99424f.svg)](https://github.com/facebook/jest)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)

provide adb(Android Debug Bridge) command functions

## Examples

### deviceList

```javascript
const adbCommander = require('adb-commander')

adbCommander.deviceList().then((deviceList, err) => {
  if (err) {
    console.error('fail to execute adb devices')
    return
  }
  if (deviceList.length > 0) {
    console.info(`devices is ${deviceList.join(',')}`)
  }
})
```

### install and isInstalled

```javascript

const adbCommander = require('adb-commander')

adbCommander.install(apkPath)
    .then(({ result, err }) => {
        if (err) {
            console.error('install failed')
        }
        adbCommander.isInstalled(deviceSn, 'org.hapjs.debugger').then(({isInstalled, err }) => {
            if(isInstalled === true){
                console.log('org.hapjs.debugger is installed')
            }
        })

     })
)

```

### unInstall

```javascript

const adbCommander = require('adb-commander')

adbCommander.uninstall( deviceSn, 'org.hapjs.debugger')
    .then(({ result, err }) => {
        if (err) {
            console.error('uninstall failed')
        }
        adbCommander.isInstalled(deviceSn, 'org.hapjs.debugger').then(({isInstalled, err }) => {
            if(isInstalled === false){
                console.log('org.hapjs.debugger is uninstalled')
            }
        })
     })
)

```

### startActivity

#### params

- deviceSn `string`
- action `string` optional
- component `string` optional
- extra `[{key: string, type: string, value: <any>}, ...]` optional

```javascript
const adbCommander = require('adb-commander')

adbCommander
  .startActivity(deviceSn, action, component, extra)
  .then(({ result, err }) => {
    if (err) {
      console.error('startActivity failed')
      return
    }
    console.log('start activity result', { result, err })
  })
```

### exeCommand 执行 adb 命令

```javascript
const adbCommander = require('adb-commander')

adbCommander.exeCommand('adb devices').then(({ result, err }) => {
  if (err) {
    console.error("exeCommand 'adb devices' failed")
    return
  }
  console.log('adb devices result', { result, err })
})
```

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