Android Debug Bridge Tips

Highlighted
Moderator

Android Debug Bridge Tips

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

# 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

Moderator

Re: Android Debug Bridge Tips

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.

sev7en
Explorer

Re: Android Debug Bridge Tips

 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)