Understanding Android Properties: Get, Set, and Use System Properties with Examples

Android system properties are key-value pairs maintained by Android’s property service, used by the operating system and native components to store and retrieve system-wide information like build details, boot configuration, feature flags, and runtime tuning.

These properties are often used by:

Android properties are read-only or read-write, depending on their prefix, and can be accessed using the getprop and setprop commands via ADB shell.


📂 Common Android Property Files

FileDescription
/system/build.propStores device-specific build info
/default.propProperties loaded during early boot
/vendor/build.propProperties specific to vendor partitions
/product/build.propProduct-defined features

🛠 Accessing Android Properties via ADB

To work with Android properties, connect your device using ADB and open a shell:

adb shell

🔍 Get Android Property Value

getprop ro.build.version.release

Explanation:
This command fetches the Android OS version of the device. The getprop tool retrieves the value associated with a property key. Here, ro.build.version.release is a read-only system property storing the Android version (e.g., “13”).


✅ Set Android Property (Runtime Only)

setprop debug.myapp.logging true

Explanation:
This command sets a custom property debug.myapp.logging to "true". Such temporary properties are often used for internal feature flags, logging control, or debugging. Note that custom properties must be prefixed with debug.*, persist.*, or ctl.* and will not survive reboot unless stored persistently.


📝 Adding Persistent Properties

To create a persistent property that survives reboots, use the persist. prefix:

setprop persist.sys.myflag.enabled 1

Then, to read it later:

getprop persist.sys.myflag.enabled

Explanation:
This property will be saved in /data/property/ and automatically loaded on boot. You can read and use it in Java, native code, or shell scripts.


🧠 Sample Use Case: Enable Debug Logs in Java via Property

Java Code (Android app or system service):

if (SystemProperties.getBoolean("debug.myapp.logging", false)) {
    Log.d("MyApp", "Debug logging is enabled.");
}

Explanation:
This code reads the value of debug.myapp.logging and enables logging if it’s set to true. SystemProperties is part of the internal Android API (android.os.SystemProperties) used primarily in system components.

⚠️ Note: SystemProperties is not part of the public SDK, so it’s typically used in system apps or AOSP code.


🔄 Listing All Android Properties

getprop

Explanation:
This command returns all active system properties with their values. It’s helpful for exploring available system flags, build information, and runtime configurations.


🗃️ Editing build.prop File (For Advanced Users)

If you’re customizing a ROM or modifying a device at the root/system level, you can edit build.prop:

adb root
adb remount
adb pull /system/build.prop

Edit using a text editor:

ro.debuggable=1
persist.sys.timezone=Asia/Kolkata

Then push it back:

adb push build.prop /system/
adb reboot

Explanation:
This gives you persistent control over low-level behavior like enabling ADB debugging, setting locale, screen density, and more.

⚠️ Warning: Incorrect editing of build.prop can cause boot loops or system instability. Always back up the original.


🛡️ Security and Access Control

Only certain property keys can be set by specific services:

  • ro.* → read-only, set at boot
  • persist.* → read/write, survives reboot
  • ctl.* → special system control commands (e.g., start/stop services)

Non-rooted apps cannot modify most system properties due to SELinux and permission constraints.

Android properties are a powerful system-level feature allowing customization, control, and configuration of the device at runtime and build-time. Whether you’re tuning system behavior, adding feature flags, or debugging, understanding how properties work gives you a solid grip over Android internals.

Have you used Android properties to enable features or debug tricky issues?
Share your experience or property hacks in the comments below 👇

Leave a Comment