You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

adb-commander

Package Overview
Dependencies
1
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

adb-commander

A typescript project


Version published
Weekly downloads
1.5K
decreased by-6.19%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

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

FAQs

Package last updated on 27 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc