1.0.1 • Published 2 years ago

adb-wrapper v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

About The Project

The adb wrapper provides a flexibal API to execute adb commands. A user can also pass the custom the adb path to it.

Getting Started

If you dont have ADB installed in your system, dont worry. It has inbuilt adb, you could also provide a path for adb explicity, which the module will use.

Prerequisites

Node js and an initialized npm folder

  • npm
    npm install adb-wrapper

See the open issues for a full list of proposed features (and known issues).

Usage

After installation of the module into your project, you can take this simple example.

import ADB from "adb-wrapper";

async function main() {
  var getAdbInstalled = await ADB.isAdbInstalled();

  if (!getAdbInstalled) return console.log("Adb is not installed");

  var deviceList = await ADB.deviceList();

  console.log(`Connected Devices ${JSON.stringify(deviceList)}`);
}

main();

There will be more functions in upcoming days as we are actively developing it. Watch it to get notified whenever we add something new to it. 😉

Methods

Here are the list of methods you can use.

  • deviceList() Returns: { type: string, udid: string, port: string} Returns Object of all detected devices by adb.

  • setCurrentActiveDevice() Prams: device (device udid) set the current active device

  • isAdbInstalled() Returns: boolean detect if adb is installed or not
  • setAdbExplicitPath() Params: path (folder path of the adb) if the adb is not installed, you can manually download it and provide the path of the folder where adb.exe exsists
  • killServer() kill the adb server
  • startServer() start the adb server
  • tcpip() Prams: port (port on which to start the adb server listening to) adb listen to a port
  • connectRemote() Params: {ip( of the remote host), port (of remort host)} (folder path of the adb) connect to a device on a remote host
  • disconnectRemote() Params: {ip( of the remote host), port (of remort host)} (folder path of the adb) disconnect to a device on a remote host
  • installApp() Params: apkPath (path of the apk) Install the app to the current active android device
  • uninstallApp() Params: packageId (the package id of the app to uninstall) uninstall the app given by the package id
  • execShellCmd() Params: shellCmd (shell command) note: dont include shell in it its equivalent to adb shell. you can execute the shell commands using it
  • getCurrentOpendedActivity() Returns: packageInfo (of the current Activity Openned) it will return the info of the current openned activity, including the package id of the app.

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE.txt for more information.

Contact

Author Name - @amir-alam-44378416b - sharpprogrammer2018@gmail.com

Project Link: https://github.com/MrSharpp/adb-wrapper-node-js

1.0.1

2 years ago

0.3.3

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.2.5

2 years ago

0.2.1

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.1

2 years ago

1.0.0

2 years ago