title: Check is vibration with ring mode enabled in Android
body: <p>Trying to detect vibration and ringing simultaneously using the code not its not working. Settings.System.VIBRATE_WHEN_RINGING is not working and always returning 0.</p>
  
  <pre><code>AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
          int mode = am.getRingerMode();
  
          switch (mode)
          {
  
              case AudioManager.RINGER_MODE_NORMAL:
  
                  if ((1 == Settings.System.getInt(getContentResolver(), Settings.System.VIBRATE_WHEN_RINGING, 0))) {
                      // code here
                      Toast.makeText(getApplicationContext(), "=== ring + vibrate mode ===", Toast.LENGTH_LONG).show();
  
  
  
                  } else {
                      // code here
                      Toast.makeText(getApplicationContext(), "=== ring + no vibrate mode ===", Toast.LENGTH_LONG).show();
                  }
  
                  break;
  
              case AudioManager.RINGER_MODE_SILENT:
  
                  Toast.makeText(getApplicationContext(), "=== in silent mode ===", Toast.LENGTH_LONG).show();
  
  
  
                  break;
  
              case AudioManager.RINGER_MODE_VIBRATE:
  
                  Toast.makeText(getApplicationContext(), "=== in vibrate mode ===", Toast.LENGTH_LONG).show();
  
  
                  break;
          }
  </code></pre>
  
  <p>Thanks in advance :)</p>