2

How to change Screen Lock sounds settings (from Settings->Sounds->screen lock sounds) checkbox programmatically on Android?

For example if I want to change haptic feedback setting i'll do:

Settings.System.putInt(m_context.getContentResolver(), Settings.System.HAPTIC_FEEDBACK_ENABLED, bEnable ? 1 : 0);

What define for Screen Lock Sounds?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Alex
  • 239
  • 5
  • 12
  • Similar to http://stackoverflow.com/questions/7696934/how-to-change-programmatically-a-global-setting-like-haptic-feedback – acj Feb 10 '13 at 21:46
  • Are you sure? If so, please tell me the constant name for this? I know to change the most settings from sounds, except this. So, please tell me the constant name. – Alex Feb 10 '13 at 21:51

1 Answers1

3

According to Android Source code its constant is "LOCKSCREEN_SOUNDS_ENABLED"

http://androidxref.com/4.2_r1/xref/packages/apps/Settings/src/com/android/settings/SoundSettings.java#301

mstfkaratas
  • 48
  • 1
  • 1
  • 6
  • 1
    thamks, it's help a lot. however this define is not present in Settings.System. I found the string associated with this constant. So the solution will be: Settings.System.putInt(m_context.getContentResolver(), "lockscreen_sounds_enabled" , bEnable ? 1 : 0); – Alex Feb 11 '13 at 12:09