adb-commander
A typescript project
Last updated 4 days ago by susanpan .
Original npm · Tarball · package.json
$ cnpm install adb-commander 
SYNC missed versions from official npm registry.

adb-commander

tested with jest code style: prettier

provide adb(Android Debug Bridge) command functions

Examples

deviceList

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


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


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
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 命令

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 })
})

Current Tags

  • 0.1.9                                ...           latest (4 days ago)

24 Versions

  • 0.1.9                                ...           4 days ago
  • 0.1.8                                ...           a year ago
  • 0.1.7                                ...           a year ago
  • 0.1.6                                ...           a year ago
  • 0.1.5                                ...           a year ago
  • 0.1.4                                ...           a year ago
  • 0.1.3                                ...           a year ago
  • 0.1.2                                ...           a year ago
  • 0.1.1                                ...           a year ago
  • 0.1.0                                ...           a year ago
  • 0.0.15                                ...           a year ago
  • 0.0.14                                ...           a year ago
  • 0.0.13                                ...           a year ago
  • 0.0.12                                ...           a year ago
  • 0.0.11                                ...           a year ago
  • 0.0.10                                ...           a year ago
  • 0.0.9                                ...           a year ago
  • 0.0.7                                ...           2 years ago
  • 0.0.6                                ...           2 years ago
  • 0.0.5                                ...           2 years ago
  • 0.0.4                                ...           2 years ago
  • 0.0.3                                ...           2 years ago
  • 0.0.2                                ...           2 years ago
  • 0.0.1                                ...           2 years ago
Maintainers (1)
Downloads
Today 18
This Week 1,947
This Month 6,581
Last Day 161
Last Week 1,508
Last Month 2,286
Dependencies (1)
Dev Dependencies (8)

Copyright 2014 - 2016 © taobao.org |