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.

deW1
  • 5,562
  • 10
  • 38
  • 54

2 Answers2

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.

SilentNot
  • 1,661
  • 1
  • 16
  • 25
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.

galian
  • 832
  • 6
  • 12
  • Refer to 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. – galian Apr 08 '22 at 02:22