Skip to content

Instantly share code, notes, and snippets.

@haydenhhyc
Last active January 25, 2025 13:18
Show Gist options
  • Select an option

  • Save haydenhhyc/4986dd6c3d50d6f47a0b54d23f64477b to your computer and use it in GitHub Desktop.

Select an option

Save haydenhhyc/4986dd6c3d50d6f47a0b54d23f64477b to your computer and use it in GitHub Desktop.
ADB Cookbook

ADB Cookbook

Some may-be-useful adb commands

# Open Android settings screen
adb shell am start -a com.android.settings.TTS_SETTINGS

# Set default Text-to-Speech (TTS) engine
adb shell settings put secure tts_default_synth <tts_engine>
adb shell settings put secure tts_default_synth com.google.android.tts  # set to Google TTS

# Get current system timeout
adb shell settings list system | grep timeout

# Set system timeout to "never"
adb shell settings put system screen_off_timeout 2147483647

# Get current launcher package
adb shell cmd shortcut get-default-launcher

# Set launcher activity
adb shell cmd package set-home-activity <your.package/.YourLauncherActivity>
adb shell cmd package set-home-activity com.example.foo/.BarActivity  # set to BarActivity in com.example.foo package

# Show information of an android package
adb shell dumpsys package <package_name>
# (pair with `grep stopped` to check if a package is in "stopped state")

# Enter adb root mode
adb root

# Sends a broadcast intent to a package
adb shell am broadcast -a <broadcast_intent> -p <package_name>

# Common intents:
# - android.intent.action.BOOT_COMPLETED (requires root)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment