Skip to content

Instantly share code, notes, and snippets.

@szepnapot
Forked from HugoMatilla/ADBCheatSheet.md
Last active August 18, 2023 09:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save szepnapot/ce3d4669b60c559e37fb8ae6a628438e to your computer and use it in GitHub Desktop.
Save szepnapot/ce3d4669b60c559e37fb8ae6a628438e to your computer and use it in GitHub Desktop.
ADB Cheat Sheet

CONFIG

Include adb and other android tools on your path

In Users/hugomatilla.bash_profile add export PATH=$PATH:/Users/hugomatilla/Documents/AndroidSDKs/sdk/platform-tools export PATH=$PATH:/Users/hugomatilla/Documents/AndroidSDKs/sdk/tools

My own adb location

cd /Users/hugomatilla/Documents/AndroidSDKs/sdk/platform-tools

START

adb shell

SERVER

Kill server

adb kill-server

Start server

adb sart-server

FILES

Sends files to device

adb push <computer.file.path> /sdcard/<device.path>

Retreive files from device

adb pull /sdcard/<device.path> <computer.file.path>

PACKAGES

List all packages

pm list packages

Uninstall

pm uninstall file.name

Install

pm install package.name

Disable

pm disable package.name

DEVICES

List all connected devices

adb devices

Clear data

pm clear package.name

INTENTS

am Command

URI

am start -a android.intent.action.VIEW -d https://github.com

Mime Type and and Extra string

am start -a "android.intent.action.SEND" --es "android.intent.extra.TEXT" "Hello World" -t "text/plain"

Activity

am start -n "com.example.application/.MainActivity"

Service

am startservice -n "com.example.application/.BackgroundService

Broadcast with Action

am broadcast -a "android.intent.action.PACKAGE_FIRST_LAUNCH" -d "com.example.application

Notification

stackoverflow am broadcast -a com.google.android.c2dm.intent.RECEIVE -n <YOUR_PACKAGE_NAME>/<YOUR_RECEIVER_NAME (in the manifest)> -e "<EXTRA_KEY_1>" "<EXTRA_VALUE_1>" -e "<EXTRA_KEY_2>" "<EXTRA_VALUE_2>"

SQLITE

cd data/data/<your-package-name>/databases/

sqlite3 <your-db-name>.db

Commands

TABLES

.tables

SCHEMA

.schema tablename

QUERY

SELECT * FROM tablename;

HELP

.help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment