Your device, your rules,Android.
An open-source operating system built on a modified Linux kernel, powering phones, tablets, TVs, cars, and wearables across the ARM ecosystem. This guide is a practical field manual for the KBVE stack: the ADB command cheatsheet, on-device data storage patterns, and Android-specific React Native notes.
One kernel, every form factor
From smartphones and tablets to Android TV, Android Auto, and Wear OS — a modular architecture lets vendors customize drivers and UI layers while Project Treble keeps updates consistent.
- ADB — control and debug any device over USB or Wi-Fi.
- Storage — SharedPreferences, SQLite, and Room.
- React Native — Expo apps with native modules when needed.
On this page
What this guide covers
ADB cheatsheet
Device, shell, and key-event commands for controlling and debugging Android over the Android Debug Bridge.
Data storage
SharedPreferences, internal and external storage, SQLite, Room, and Content Providers — with Java examples.
React Native
Android-specific notes for KBVE's React Native and Expo apps, kept alongside the wider React Native section.
Rooted with care
Many shell and dumpsys commands need root and can brick a device — log every command and keep a backup.
Start here
Information
Are you ready to step into the heart of a global Android revolution, where millions of users and developers collaborate to improve the open source mobile operating system, giving you endless possibilities to customize your device and operating system. Unleash your creativity and make your smartphone, tablet, or smartwatch truly your own with the endless array of apps and features available on Android, tailored to fit your unique needs and preferences. Our job at KBVE will be to provide you with everything you need to deploy your own Android application on almost any device!
This one page guide is meant to serve as your resource manual moving forward, we will start with the cheat sheet below, that makes it easy to reference back in the future.
Jump to the ADB cheatsheet, data storage, or React Native notes.
ADB reference
Cheatsheet
The ADB cheat sheet is an essential resource for navigating and managing Android operating systems and applications via the Android Debug Bridge (ADB). It offers a comprehensive list of basic commands that facilitate various tasks such as installing apps, debugging issues, and accessing device logs. While the cheat sheet covers a wide range of functionalities, it’s important to note that some commands require root access, and certain Android versions may necessitate specific tweaks to the standard commands. This makes the cheat sheet a versatile and indispensable tool for both novice users and experienced developers working with Android devices.
Device Commands
Section titled “Device Commands”Android ADB Device commands are commands that you can use to control the Android device over USB from a computer. You can use them to list all devices, restart the ADB server, and reboot connected devices.
| Command | Description | Notes / Variants |
|---|---|---|
adb devices | List all connected devices. | |
adb devices -l | Query additional information (model, product, transport ID). | Useful for identifying multiple devices. |
adb get-state | Display the current device state (device, offline, or unauthorized). | |
adb get-serialno | Query the device’s serial number. | |
adb root | Launch the ADB daemon (adbd) with root permissions. | May fail on production builds: adbd cannot run as root in production builds. |
adb start-server | Start the ADB server daemon. | Runs automatically if missing when using other ADB commands. |
adb kill-server | Terminate the ADB server process. | Use to restart ADB cleanly if it becomes unresponsive. |
adb reboot | Reboot the currently connected device. | Accepts optional args like bootloader or recovery. |
adb help | Display general help and usage information. | Lists all supported subcommands. |
ADB shell is a command-line interface that you can use to access the shell and run various commands on your Android device. You can use ADB shell commands to perform actions such as changing the resolution of your device display, uninstalling bloatware or system apps, enabling and disabling features, modifying the system files, ect..
| Command | Description | Notes / Variants |
|---|---|---|
adb shell | Launch the interactive shell terminal on the connected device. | Equivalent to opening a remote terminal session. |
adb -s $deviceString $deviceCommand | Send a command ($deviceCommand) to a specific device identified by $deviceString. | Useful when multiple devices are connected. |
adb shell pwd | Print the current working directory on the device. | |
adb shell ls | List the contents of the current directory. | |
adb shell ls -s | List directory contents with file size information. | |
adb shell ls -R | Recursively list contents of all subdirectories. | |
adb shell netstat | Display current TCP/IP network connections. | Useful for debugging sockets and ports. |
adb shell dumpsys | Dump system service information and status reports. | A powerful diagnostic tool for system introspection. |
adb shell dumpsys iphonesybinfo | Retrieve IMEI and related telephony information. | Typo in some Android versions — should be iphonesubinfo. |
adb shell dumpsys battery | Display current battery status and related data. | |
adb shell dumpsys battery set level $v | Manually set battery level from 0 to 100. | Useful for testing low-power states. |
adb shell dumpsys battery reset | Reset battery state to default (real readings). | |
adb shell dumpsys activity $package | Dump activity information for a specific package. | |
adb shell pm list features | List available hardware and software features. | |
adb shell service list | List all registered Android system services. | Often used before running targeted dumpsys queries. |
adb shell wm | Base command for WindowManager operations. | Placeholder — requires subcommands. |
adb shell wm size | Show the current screen resolution. | |
adb shell wm size $WxH | Set custom screen resolution (e.g., 1080x1920). | |
adb shell wm size reset | Reset screen resolution to default. | |
adb shell wm density | Show the current display density (DPI). | |
adb shell wm density reset | Reset display density to system default. | |
adb shell ps | List all running processes on the device. | Similar to Linux ps command. |
exit | Exit the current ADB shell session. | Returns to the host terminal. |
Key Events
Section titled “Key Events”Android Key Events - A quick breakdown for each event and how the operating system handles them.
Generic Android Keyevents:
adb shell input keyevent| Keycode | Command Example | Description |
|---|---|---|
| 0 | adb shell input keyevent 0 | Keycode 0 |
| 1 | adb shell input keyevent 1 | Soft Left |
| 2 | adb shell input keyevent 2 | Soft Right |
| 3 | adb shell input keyevent 3 | Home Button Event |
| 4 | adb shell input keyevent 4 | Back Button Event |
| 5 | adb shell input keyevent 5 | Call Event |
| 6 | adb shell input keyevent 6 | End Call / Hangup Event |
| 7 | adb shell input keyevent 7 | Keycode 0 |
| 8 | adb shell input keyevent 8 | Keycode 1 — Number 1 |
| 9 | adb shell input keyevent 9 | Keycode 2 — Number 2 |
| 10 | adb shell input keyevent 10 | Keycode 3 — Number 3 |
| 11 | adb shell input keyevent 11 | Keycode 4 — Number 4 |
| 12 | adb shell input keyevent 12 | Keycode 5 — Number 5 |
| 13 | adb shell input keyevent 13 | Keycode 6 — Number 6 |
| 14 | adb shell input keyevent 14 | Keycode 7 — Number 7 |
| 15 | adb shell input keyevent 15 | Keycode 8 — Number 8 |
| 16 | adb shell input keyevent 16 | Keycode 9 — Number 9 |
| 17 | adb shell input keyevent 17 | STAR (*) Key |
| 18 | adb shell input keyevent 18 | Pound (#) Key |
-
Koltin:
open class KeyEvent: InputEvent, Parcelable -
Java:
public class KeyEvent extends InputEvent implements Parcelable
Persistence
Android Data Storage
In Android, there are several ways to store data persistently. The choice of storage mechanism depends on the nature of the data and the requirements of the app. Below are the primary methods for data storage in Android:
Comparison of Storage Options
| Storage Method | Visibility | Persistence | Complexity | Best For |
|---|---|---|---|---|
| SharedPreferences | Private | Until app uninstall | Low | Small key-value pairs |
| Internal Storage | Private | Until app uninstall | Low | Private files |
| External Storage | Public | Until manually deleted | Medium | Large/shared files |
| SQLite Database | Private | Until app uninstall | High | Structured data |
| Room | Private | Until app uninstall | Medium-High | Structured data with compile-time safety |
When choosing a storage method, consider the type of data you’re storing, how much data you need to store, the required level of security, and the complexity you’re willing to manage in your app.
- SharedPreferences
SharedPreferences is a framework that allows you to save and retrieve key-value pairs of primitive data types.
Use Cases
- Storing user preferences.
- Saving settings or configuration data.
Advantages:
- Simple to use for small amounts of data
- Data persists across app restarts
Disadvantages:
- Not suitable for large or complex data structures
- Not encrypted by default
Java Code Example
// Saving data to SharedPreferencesSharedPreferences sharedPref = getSharedPreferences("MyPrefs", Context.MODE_PRIVATE);SharedPreferences.Editor editor = sharedPref.edit();editor.putString("key_name", "value");editor.apply();
// Retrieving data from SharedPreferencesSharedPreferences sharedPref = getSharedPreferences("MyPrefs", Context.MODE_PRIVATE);String value = sharedPref.getString("key_name", "default_value");- Internal Storage
Internal Storage is used to store private data within the device’s internal memory.
Use Cases
- Storing sensitive data.
- Files that should not be accessible to other apps.
Advantages:
- Data is private to the app.
- Files are removed when the app is uninstalled.
Disadvantages:
- Limited by device storage.
- Not easily accessible for backup.
Java Code Example
// Writing to internal storageString filename = "myfile";String fileContents = "Hello, World!";FileOutputStream fos = openFileOutput(filename, Context.MODE_PRIVATE);fos.write(fileContents.getBytes());fos.close();
// Reading from internal storageFileInputStream fis = openFileInput(filename);InputStreamReader isr = new InputStreamReader(fis);BufferedReader br = new BufferedReader(isr);StringBuilder sb = new StringBuilder();String line;while ((line = br.readLine()) != null) { sb.append(line);}String fileContents = sb.toString();fis.close();- External Storage
External Storage is used to store public data on the shared external storage. It’s typically used for storing larger files.
Use Cases
- Storing media files (images, videos, audio)
- Documents that need to be shared with other apps.
Advantages:
- Larger storage capacity
- Files can be shared with other apps
Disadvantages:
- Not secure, as other apps can access the files
- Files may remain after app uninstallation
Permissions
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/><uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>Java Code Example
// Writing to external storageString filename = "myfile";String fileContents = "Hello, World!";File file = new File(getExternalFilesDir(null), filename);FileOutputStream fos = new FileOutputStream(file);fos.write(fileContents.getBytes());fos.close();
// Reading from external storageFile file = new File(getExternalFilesDir(null), filename);FileInputStream fis = new FileInputStream(file);InputStreamReader isr = new InputStreamReader(fis);BufferedReader br = new BufferedReader(isr);StringBuilder sb = new StringBuilder();String line;while ((line = br.readLine()) != null) { sb.append(line);}String fileContents = sb.toString();fis.close();- SQLite Database
SQLite is a lightweight relational database embedded within Android.
Use Cases
- Structured data storage.
- Complex querying requirements.
- Managing complex data relationships
Advantages:
- Efficient for complex queries and large datasets
- Supports transactions and data integrity
Disadvantages:
- More complex to set up and use compared to other options
- Overkill for simple data storage needs
Java Code Example
// Creating a database helperpublic class MyDatabaseHelper extends SQLiteOpenHelper { private static final String DATABASE_NAME = "mydatabase.db"; private static final int DATABASE_VERSION = 1;
public MyDatabaseHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); }
@Override public void onCreate(SQLiteDatabase db) { db.execSQL("CREATE TABLE mytable (id INTEGER PRIMARY KEY, name TEXT)"); }
@Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS mytable"); onCreate(db); }}
// Using the database helperMyDatabaseHelper dbHelper = new MyDatabaseHelper(context);SQLiteDatabase db = dbHelper.getWritableDatabase();
// Inserting dataContentValues values = new ContentValues();values.put("name", "John Doe");long newRowId = db.insert("mytable", null, values);
// Querying dataCursor cursor = db.query("mytable", new String[]{"id", "name"}, null, null, null, null, null);while (cursor.moveToNext()) { long itemId = cursor.getLong(cursor.getColumnIndexOrThrow("id")); String itemName = cursor.getString(cursor.getColumnIndexOrThrow("name"));}cursor.close();db.close();- Room Database
Room is an abstraction layer over SQLite that provides a more robust database access while harnessing the full power of SQLite.
Use Cases:
- When you need a robust database solution but want to avoid the complexity of raw SQLite
Advantages:
- Compile-time verification of SQL queries
- Convenient annotations to define database structure
- Easy integration with other Architecture components
Disadvantages:
- Adds additional dependencies to your project
- May be overkill for very simple data storage needs
Java Code Example
// Define Entity@Entity(tableName = "user")public class User { @PrimaryKey public int id; public String name;}
// Define DAO@Daopublic interface UserDao { @Insert void insert(User user);
@Query("SELECT * FROM user WHERE id = :id") User getUserById(int id);}
// Define Database@Database(entities = {User.class}, version = 1)public abstract class AppDatabase extends RoomDatabase { public abstract UserDao userDao();}
// Using RoomAppDatabase db = Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "mydatabase").build();UserDao userDao = db.userDao();
// Inserting dataUser user = new User();user.id = 1;user.name = "John Doe";userDao.insert(user);
// Querying dataUser user = userDao.getUserById(1);- Content Providers
Content Providers manage access to a structured set of data. They encapsulate the data and provide mechanisms for defining data security.
Use Cases
- Sharing data between different applications.
- Accessing data from other applications.
Java Code Example
// Querying a content providerCursor cursor = getContentResolver().query( ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
while (cursor.moveToNext()) { String id = cursor.getString( cursor.getColumnIndex(ContactsContract.Contacts._ID)); String name = cursor.getString( cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));}cursor.close();Cross-platform
React Native
This part of the guide goes into the specific parts of React Native and Android, we do try to keep all our react native notes into one area. We recommend going to the React Native section as well, but there might be double notes in this section.
Questions
Frequently asked
What is ADB (Android Debug Bridge)?
ADB is a command-line tool that lets a computer control an Android device over USB or Wi-Fi. It is used to install and uninstall apps, push and pull files, read device logs with logcat, open a device shell, and debug applications during development.
How do I connect a device with ADB?
Enable Developer Options and USB debugging on the device, connect it over USB, and run adb devices to confirm it is listed. Some commands need root access, and certain Android versions may require slightly different command syntax.
What languages are used for Android development?
Native Android apps are written in Kotlin (now preferred) or Java against the Android SDK. Cross-platform options include React Native and Flutter. KBVE's Android apps use React Native with Expo, with native modules added when a feature needs platform-specific code.
Is Android open source?
Yes. Android is built on the open-source Android Open Source Project (AOSP) on top of a modified Linux kernel. Vendors customize drivers and UI layers on top, while Project Treble and mainline modules allow more consistent updates and faster security patches.
What is Android used for beyond phones?
Android extends well past phones and tablets into specialized distributions — Android TV for televisions, Android Auto for vehicles, and Wear OS for smartwatches — plus growing use in embedded, desktop, and server-adjacent devices thanks to its modular architecture.
