Android how to get current System Settings values?
Asked Answered
B

2

7

I know that I can change the Settings with:

Settings.System.putInt( getContentResolver() , 
         Settings.System.SCREEN_OFF_TIMEOUT , DELAY );

but I honestly can't find a solution on how to read the current value of that / any setting.

Booklet answered 16/3, 2014 at 12:8 Comment(0)
B
6

check out http://developer.android.com/reference/android/provider/Settings.System.html

getInt(ContentResolver cr, String name, int def) Convenience function for retrieving a single system settings value as an integer.

Bight answered 16/3, 2014 at 12:30 Comment(0)
A
0

It's not allowed to read/write settings by non-system apps from Android 10.

https://developer.android.google.cn/about/versions/10/privacy/changes#non-resettable-device-ids

Starting in Android 10, apps must have the READ_PRIVILEGED_PHONE_STATE privileged permission in order to access the device's non-resettable identifiers, which include both IMEI and serial number.

Afflictive answered 8/4, 2022 at 2:11 Comment(1)
Refer to developer.android.google.cn/about/versions/10/privacy/… Starting in Android 10, apps must have the READ_PRIVILEGED_PHONE_STATE privileged permission in order to access the device's non-resettable identifiers, which include both IMEI and serial number.Afflictive

© 2022 - 2025 — McMap. All rights reserved.