Useful ADB commands to note.

List currently connected devices

  • adb devices

Kill your currently running ADB instance

  • adb kill-server

Connect to your device remotely

Replace 0.0.0.0:5555 below with your device’s actual local IP address & port. (5555 is typically the default).

  • adb connect 0.0.0.0:5555

Display build type

This will either display user, userdebug, or eng.

In order of most secure to least secure: user > userdebug > eng.

You can see here for more details on this & what it means, as well as Android’s security model in general.

  • adb shell getprop ro.build.type

Display device model

  • adb shell getprop ro.hardware

Display device log

  • adb logcat

Reboot your device

  • adb shell reboot

Reboot your device into fastboot

  • adb reboot bootloader

Reboot your device into recovery

  • adb reboot recovery

See all available settings

  • adb shell settings list system

  • adb shell settings list global

  • adb shell settings list secure

  • adb shell settings list system && adb shell settings list global && adb shell settings list secure

Check current value of a setting

Replace domain with either system, global, or secure depending on the area where your setting is located above.

adb shell settings get domain captive_portal_mode

Change a setting

Replace domain with either system, global, or secure depending on the area where your setting is located above, and change value to the value you would like to change your setting to.

  • adb shell settings domain put value

Reset a setting

Replace domain with either system, global, or secure depending on the area where your setting is located above, and change value to the value you would like to change your setting to.

  • adb shell settings delete domain value

Launch WebView DevTools

This allows you to change flags for the system WebView, just how you would on standard Chromium browsers via chrome://flags.

adb shell am start -a "com.android.webview.SHOW_DEV_UI"

List installed apps

  • adb shell pm list packages

Install an app remotely

Replace path/example.apk with the location of your .apk file.

  • adb install path/example.apk

If you would like to install the app to your external storage (Ex. SD Card) if available, you could also append -s as follows:

  • adb install -s path/example.apk

Disable an app

Replace com.package.example with the package ID of the app you would like to disable from above.

  • adb shell pm disable-user --user 0 com.package.example

Re-enable an app

Replace com.package.example with the package ID of the app you would like to re-enable from above.

  • adb shell pm enable com.package.example

Uninstall an app

When uninstalling apps through ADB, be sure to also disable the app. (Yes, you can do both… Android is weird sometimes :P).

If you do not also disable the app, other apps on your device will still think the removed app is present, and may try to use it as a dependency, causing unnecessary breakage, issues, & crashing.

Examples with Signal:

https://github.com/signalapp/Signal-Android/issues/10368

https://github.com/signalapp/Signal-Android/issues/11139

https://github.com/signalapp/Signal-Android/issues/9279

See here for more details.

Replace com.package.example with the package ID of the app you would like to remove from above.

  • adb shell pm uninstall --user 0 com.package.example

  • adb shell pm disable-user --user 0 com.package.example

  • adb shell pm uninstall --user 0 com.package.example && adb shell pm disable-user --user 0 com.package.example

If you would like to keep app data, you could also append -k as follows:

  • adb shell pm uninstall -k --user 0 com.package.example

  • adb shell pm uninstall -k --user 0 com.package.example && adb shell pm disable-user --user 0 com.package.example

Re-install an app

Replace com.package.example with the package ID of the app you would like to re-install from above.

  • adb shell cmd package install-existing com.package.example

  • adb shell pm enable com.package.example

  • adb shell cmd package install-existing com.package.example && adb shell pm enable com.package.example

Change Connectivity Check Servers

See here for more information on what a connectivity check is & why it matters.

Due to the privacy concerns it poses, its generally a good idea to change it away from Google’s default servers.

For this example, I’ll be using the connectivity servers belonging to GrapheneOS, as that is what I recommend using if possible. You could simply replace the following URLS though with another server if desired.

  • adb shell settings put global captive_portal_http_url http://connectivitycheck.grapheneos.network/generate_204

  • adb shell settings put global captive_portal_https_url https://connectivitycheck.grapheneos.network/generate_204

  • adb shell settings put global captive_portal_fallback_url http://grapheneos.online/gen_204

  • adb shell settings put global captive_portal_other_fallback_urls http://grapheneos.online/generate_204

  • adb shell settings put global captive_portal_http_url http://connectivitycheck.grapheneos.network/generate_204 && adb shell settings put global captive_portal_https_url https://connectivitycheck.grapheneos.network/generate_204 && adb shell settings put global captive_portal_fallback_url http://grapheneos.online/gen_204 && adb shell settings put global captive_portal_other_fallback_urls http://grapheneos.online/generate_204

If you would like to reset the servers back to Google’s defaults:

  • adb shell settings put global captive_portal_http_url http://connectivitycheck.gstatic.com/generate_204

  • adb shell settings put global captive_portal_https_url https://www.google.com/generate_204

  • adb shell settings put global captive_portal_fallback_url http://www.google.com/gen_204

  • adb shell settings put global captive_portal_other_fallback_urls http://play.googleapis.com/generate_204

  • adb shell settings put global captive_portal_http_url http://connectivitycheck.gstatic.com/generate_204 && adb shell settings put global captive_portal_https_url https://www.google.com/generate_204 && adb shell settings put global captive_portal_fallback_url http://www.google.com/gen_204 && adb shell settings put global captive_portal_other_fallback_urls http://play.googleapis.com/generate_204

Disable Connectivity Checks/Captive Portal Functionality Entirely

Depending on your use case & situation, it could also be advisable to simply disable Connectivity Checks/Captive Portal functionality entirely. This is especially useful for devices like Android TV.

In addition to the previous link above, also see here for more information on the privacy & security risks involved with Captive Portals.

  • adb shell settings put global captive_portal_mode 0

  • adb shell settings put global captive_portal_detection_enabled 0

  • adb shell pm uninstall --user 0 com.android.captiveportallogin

  • adb shell pm disable-user --user 0 com.android.captiveportallogin

  • adb shell settings put global captive_portal_mode 0 && adb shell settings put global captive_portal_detection_enabled 0 && adb shell pm uninstall --user 0 com.android.captiveportallogin && adb shell pm disable-user --user 0 com.android.captiveportallogin

Re-enable Connectivity Checks/Captive Portal Functionality

  • adb shell cmd package install-existing com.android.captiveportallogin

  • adb shell pm enable com.android.captiveportallogin

  • adb shell settings put global captive_portal_mode 1

  • adb shell settings put global captive_portal_detection_enabled 1

  • adb shell cmd package install-existing com.android.captiveportallogin && adb shell pm enable com.android.captiveportallogin && adb shell settings put global captive_portal_mode 1 && adb shell settings put global captive_portal_detection_enabled 1

Change Time Server

By default, Android uses Google’s servers for checking & automatically updating the system clock.

Due to the privacy concerns it poses, its generally a good idea to change it away from Google’s default servers.

This only appears to work on some Android distributions, YMMV.

For this example, I’ll be using the time server belonging to GrapheneOS, as that is what I recommend using if possible. You could simply replace the following domain though with another server if desired.

  • adb shell settings put global ntp_server time.grapheneos.org

If you would like to reset the server back to Google’s default:

  • adb shell settings put global ntp_server time.android.com

Configure Encrypted DNS

Generally you can just toggle Android’s Private DNS feature through your system settings. However, this functionality is not exposed in the UI on some devices, such as those running Android TV, even though the functionality is fully there & available. I would highly recommend doing this due to the major privacy & security benefits it provides.

For this example, I’ll be using Quad9, though I would recommend setting up & configuring NextDNS or your own AdGuard Home instance if possible. If you wish to use another DNS provider, replace dns.quad9.net with another server. Just ensure that the domain you’re using is DNS over TLS!!

To enable:

  • adb shell settings put global private_dns_mode hostname

  • adb shell settings put global private_dns_specifier dns.quad9.net

  • adb shell settings put global private_dns_mode hostname && adb shell settings put global private_dns_specifier dns.quad9.net

If you would like to disable this functionality:

  • adb shell settings put global private_dns_mode off

Disable Cellular Functionality

I would generally recommend avoiding this, though it is useful in special cases.

  • adb shell settings put global cell_on 0

  • adb shell settings put global mobile_signal_detector 0

  • adb shell settings put global cell_on 0 && adb shell settings put global mobile_data 0 && adb shell settings put global mobile_signal_detector 0

Re-enable Cellular Functionality

  • adb shell settings put global cell_on 1

  • adb shell settings put global mobile_signal_detector 1

  • adb shell settings put global cell_on 1 && adb shell settings put global mobile_signal_detector 1

Disable Wi-Fi Network Available Notifications

I would highly recommend disabling this if possible, though this is generally unnecessary since it can typically be controlled through system settings.

  • adb shell settings put global wifi_networks_available_notification_on 0

Re-enable Wi-Fi Network Available Notifications

  • adb shell settings put global wifi_networks_available_notification_on 1

Disable sensitive notifications on lockscreen

I would highly recommend disabling this if possible, though this is generally unnecessary since it can typically be controlled through system settings.

  • adb shell settings put secure lock_screen_allow_private_notifications 0

Re-enable sensitive notifications on lockscreen

  • adb shell settings put secure lock_screen_allow_private_notifications 1

Disable Bug Reporting

  • adb shell settings put global bug_report 0

Re-enable Bug Reporting

  • adb shell settings put global bug_report 1