Search code examples
javaandroidjava-native-interfacenativeandroid-2.3-gingerbread

Accessing android.provider.Settings.System values from platform code


Is there a way to access Settings.System (i.e. persistent values) from platform code?

The idea is to read in some specific values from the storage area for data defined in Settings.System (if one exists).

So I see it as something like:

Manager.java ->(add data)-> [Settings.System database] ->(pull out data)-> DataManager.cpp

Manager.java and DataManager.cpp run completely separate from one another and in different processes.

Maybe someone could explain how persistent values operate on a low level or point me in the right direction?

Cheers.

Edit: Ok, so there is a db file under data/data/com.android.providers.settings/databases/settings.db


Solution

  • I found a way to do this. You can find the settings database by executing the following:

       $ adb shell
       $ su
       # find data -name "settings.db" -print
       data/data/com.android.providers.settings/databases/settings.db
    

    And then use sqlite3 to read in values at a native level.