How to read android vibration settings?

Can the vibration setting for a call be read?

I get the vibration state using:

if(audioManager.getRingerMode() == AudioManager.RINGER_MODE_SILENT) { //silent } else if(audioManager.getRingerMode() == AudioManager.RINGER_MODE_VIBRATE) { ringPhone(callerRing); vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); long[] pattern = { 0, 1000, 1000 }; vibrator.vibrate(pattern, 0); } else if(audioManager.getRingerMode() == AudioManager.RINGER_MODE_NORMAL) { ringPhone(callerRing); } 

In the case of RINGER_MODE_NORMAL , I want to set the vibration setting for an incoming call.

In the Android system settings there is an option inside Sound, "Vibrate on ring". I need to read this opportunity for failure.

Any help would be appreciated.

thanks

+4
source share
1 answer

A little late, but I need to do the same and solve it:

 public static boolean checkVibreationIsOn(Context context) { return (1 == Settings.System.getInt(context.getContentResolver(), "vibrate_when_ringing", 0)); //vibrate on } 
0
source

Source: https://habr.com/ru/post/1480697/


All Articles