Jump to content

Android Debug Bridge Tips


JustinVive

Recommended Posts

ADB Tips

Visit the Android Debug Bridge Developer Site for indepth information - https://developer.android.com/studio/command-line/adb
========

# install a custom launcher: 
adb install -r MatrixDD.apk

 

# set and start launcher (e.g. the one above):
adb shell cmd package set-home-activity com.htc.mobilevr.launcher/com.htc.vr.unity.WVRUnityVRActivity
adb shell am start -n com.htc.mobilevr.launcher/com.htc.vr.unity.WVRUnityVRActivity

 

# reset launcher back to the Android phone launcher:
adb shell cmd package set-home-activity com.android.launcher/com.android.launcher2.Launcher
adb shell am start -n com.android.launcher/com.android.launcher2.Launcher

 

# run an app:
adb shell am start -n <package-name>/<activity-name>
# e.g. adb shell am start -n com.htc.bowshot_3DOF/com.htc.vr.unity.WVRUnityVRActivity

 

# list 3rd party installed packages:
adb shell cmd package list packages -3

 

# find activity of an installed package: (from an apk: aapt dump badging yourapp.apk)
adb shell cmd package resolve-activity --brief <package-name>

 

# uninstall a package e.g. Vysor:
adb uninstall com.koushikdutta.vysor

 

# turn bluetooth on:
adb root
adb shell service call bluetooth_manager 6

adb shell am start -a android.settings.BLUETOOTH_SETTINGS

# use 8 to turn off


# for wifi use: adb shell svc wifi enable # or disable
adb unroot

 

# power down:
adb shell reboot -p

 

# check battery level:
adb shell "dumpsys battery | grep level"

 

# adb over wifi (setup wifi connection first):
# find ip address:
adb shell "ifconfig wlan0 | grep 'inet addr:'"


# restart adb over wifi:
adb tcpip 5555


# connect over wifi: (you can now disconnect usb cable)
adb connect <ip address>:5555


# to revert to usb:
adb usb # or just reboot

Link to comment
Share on other sites

I forgot to add the following keyboard input adb command:

 

adb shell input keyevent 23

   useful for selecting a popup dialog to set focus on or to 'click' on a selection or button

 

   to navigate to a button use the following key codes (includes volume control)

 

19 -->  "KEYCODE_DPAD_UP" 20 -->  "KEYCODE_DPAD_DOWN" 21 -->  "KEYCODE_DPAD_LEFT" 22 -->  "KEYCODE_DPAD_RIGHT" 23 -->  "KEYCODE_DPAD_CENTER" 24 -->  "KEYCODE_VOLUME_UP" 25 -->  "KEYCODE_VOLUME_DOWN" 

 

In summary you can use adb commands to avoid having to use or install Vysor. 

You can also automate standard Android UI navigation with scripts. 

 

Eventually all of the Android UI popup dialogs will be in VR, but for now (e.g. for a rom update) you can navigate and click on buttons with the keycodes above and just use adb from the command line.

Link to comment
Share on other sites

  • 11 months later...

 Thanks for the wonderful job and just an add on for the installation of the apps with and without multi-devices connected:

adb install example.apk (for the installation in the memory of the device)

adb install -s example (for the installation in the SD-Card of the device)

 

 

 

  • Like 1
Link to comment
Share on other sites

  • 1 year later...

bumping this thread and adding the following for reference (from another thread):

play movie file:
adb shell am start -a android.intent.action.VIEW  -t video/mp4 -d  content://com.android.externalstorage.documents/document/primary/file.mp4

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

  • 1 year later...
On 9/17/2020 at 5:03 AM, Dario said:

bumping this thread and adding the following for reference (from another thread):

play movie file:
adb shell am start -a android.intent.action.VIEW  -t video/mp4 -d  content://com.android.externalstorage.documents/document/primary/file.mp4

Hi, can you mention more details about it, what is the issue you are facing about it. Sometime it debugs of it but you need to fix them 

Edited by jonnwarne
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...