npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

androidctrl

v1.2.2

Published

Node module for managing and controlling the Android Emulator

Downloads

86

Readme

androidctrl Build Status

Node module for managing and controlling Android devices and emulators.

Install

npm install --save androidctrl

API

start(avdName)

Start the emulator using the AVD supplied through with avdName. Returns a promise that is resolved with an object that has the following properties.

{
  id: String, // The ID of the emulator
  process: Object // The child_process object
}

waitForDevice(deviceId)

Return a promise that will be resolved when the device specified with deviceId is ready (adb daemon is running).

ensureReady(deviceId)

Resolves a promise when the device with the id deviceId has completed its boot process.

adb(deviceId, cmd)

Run an adb command on the device with the id deviceId, and resolve to an object containing the following:

{
    code: Number, // the exit code of the process,
    stdout: String, // The captured stdout
    stderr: String // The captured stderr
}

createAVD(targetId, name, hardwareOptions)

Create an AVD based upon targetId (from listTargets). Returns a promise that will be resolved when the AVD has finished being created.

listTargets

Resolves to an array of Android target objects that can be used with createAVD.

The array looks like:

[
  {
    id: '1 or "android-22"',
    Name: 'Android 5.1.1',
    Type: 'Platform',
    level: '22',
    Revision: '2',
    Skins: 'HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in'
  },
  {
    id: '2 or "android-23"',
    Name: 'Android 6.0.0',
    Type: 'Platform',
    level: '23',
    Revision: '2',
    Skins: 'HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in'
  }
]

hasAVD(name)

Resolves to true if the AVD exists, or false if it does not.

listAVDs

Resolves to an array of Android AVD objects that can be used in conjunction with start(avd.Name).

The array looks like:

[
  {
    Name: 'Android511',
    Device: 'Nexus 5 (Google)',
    Path: '/Users/michael/.android/avd/Android511.avd',
    Target: 'Android 5.1.1 (API level 22)',
    'Tag/ABI': 'default/x86',
    Skin: '1080x1920',
    Sdcard: '500M'
  },
  {
    Name: 'Android600',
    Device: 'Nexus 5 (Google)',
    Path: '/Users/michael/.android/avd/Android600.avd',
    Target: 'Android 6.0.0 (API level 23)',
    'Tag/ABI': 'default/x86',
    Skin: '1080x1920',
    Sdcard: '500M'
  }
]

devices

Resolves to an array of device objects.

The array looks like:

[
  { name: 'emulator-5554', status: 'device' },
  { name: 'emulator-5555', status: 'device' },
  { name: 'emulator-5556', status: 'offline' }
]

listPackages(deviceId)

Returns a promise that resolves to an array containing packages installed on the device with deviceId.

The array looks like:

[
  'com.android.smoketest',
  'com.example.android.livecubes',
  'com.android.providers.telephony',
  'com.android.providers.calendar',
  'com.android.providers.media',
  'com.android.protips',
  'com.android.launcher',
  'com.android.documentsui',
  'com.android.gallery',
  'com.android.externalstorage'
]

isInstalled(packageName)

Returns a promise that resolves with a boolean value that is true if the package specified with packageName is installed.

install(deviceId, apkPath, reinstall=false)

Install an APK located by absolute URI apkPath onto device with deviceId.

Returns a Promise that resolves to undefined on success, and throws 'Already installed' if it's already installed.

If reinstall is true, than the package will be reinstalled and all related data will be kept.

stop(deviceId)

Stop the device specified with deviceId. (This should only be used with emulators. It will kill the process.)

powerOn(deviceId)

Presses the power on button on the phone.

unlock(deviceId)

Presses the unlock button on the phone.

inputKeyEvent(deviceId, keyCode)

Sends a key event with keyCode to device specified with deviceId.