Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android System Properties

Tags:

android

Do the following access the same internal set of properties or is there any difference in their semantics?

  • java.lang.System.setProperty(String key, String value)

  • android.os.SystemProperties.set(String key, String value)

  • adb shell setprop 'key' 'value'

For example, after calling:

System.setProperty("myprop", "1");

adb shell getprop myprop returns an empty string.


Note: SystemProperties is an internal class, not exposed in the SDK, but used by other system classes.

like image 729
Martin Konicek Avatar asked Sep 05 '25 19:09

Martin Konicek


1 Answers

SystemProperties.set() and adb shell setprop are inter-operable: they both alter the same system property value.

However, System.setProperty() is Java and VM specific, and uses different key/value naming convention.

like image 50
ozbek Avatar answered Sep 08 '25 10:09

ozbek