ADB – Android Debug Bridge, is probably the coolest feature in the Android world, in my opinion! (how little I know about this world!)

In this post, I will demonstrate how you can combine Node JS with ADB to create the ‘Thunder-Impact’.


The back camera of the phone is way better in quality that the front-selfie one.

As someone who makes Youtube videos, I strive to capture the best quality I can, thus it is highly important to use the back camera!

However, since I don’t see what that lenses sees (you know, I’m facing the camera, and the screen is at the back-side…), I wanted to transfer that feed to my main monitor, so I can adjust my posture and get that perfect high quality frame!

Initially, the plan was to launch the camera app, and then take screenshots at a high frequency ratio, and display those images on my monitor, using a desktop app (but that is a different story for another day!).

Then, very quickly, I got interested in ADB itself!!

I don’t have a mirror, so I had to get creative!

In a nutshell, ADB, is a tool which let you access your phone (whether sending it commands, or accessing its filesystem via a linux shell) from the comfort of your PC!

The Setup:

  • Put your device on ‘Developer Mode’ (i.e. enable debugging via USB)
  • copy the ADB into your project directory:
    • the ADB is found in the ‘platform-tools’ dir. (see image bellow).
  • install the package called appium using npm. (details on their github. follow link.)
Notice that I copied the contents of the ‘platform-tools’ dir to my project’s dir

I was fortunate enough to find some adb packages on npm which I used (package called appium) to build this simple (yet deadly) Node script:

const appuimADB = require('appium-adb')
const  {ADB} = appuimADB
let adb = new ADB();

// calling the function

 * captures a screenshot, names it 'screenshot.png' in the Android,
 * and puuls it to the PC.
 * the 2nd arg which 'pull' takes, is the name of the file to be-
 * shown in the PC.
 * Using the '.then' to ensure that the pulling occures after taking-
 * the picture
function getScreen() {'screencap -p  /sdcard/screencap.png')
  .then(() => {adb.pull('/mnt/sdcard/screencap.png', 'screencap.png')})

The code above is capturing the screen off your phone (yes, a screenshot!) and pulls it from the Android device to the PC!


definitely NOT a big fan of selfies!!

Alright, let’s up it another notch!

Right now we are interested in installing an app on the device!

That’s correct, you create the APK file on your PC, and install it on the phone. Note that the APK file is always signed by you!

So this one is fairly easy to pull, you simply use this command:

$ adb install <path_to_apk_on_your_PC>

Now, with our Node js package, we are luck to have the exec command!


function installApp(apk_path) {
  adb.adbExec(['install' ,apk_path])

That’s about it for this post.

Although this might not be some deadly Terminator-Matrix type tricks, it is definitely has its glorified coolness, that I am aiming to expand.

I will come back with more advanced stuff.

Stay Tuned.

As always, follow the updated code on GitHub