title: Android, Phone playing notification sounds even when on silent? Should I be checking for silent mode?
body: <p>I was very surprised to find in the app I am currently programming that when I make it play a notification sound, it plays regardless of whether the phone has been set to silent or not!</p>
  
  <p>Surely the phones silent mode should be an overriding feature or am I meant to be checking?
  I had a quick look at the documentation but did not see anything saying this? Am I missing something?</p>
  
  <p>This is my notification code:</p>
  
  <pre><code>    Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
          v.vibrate(300);
  
          Uri alert = RingtoneManager
                  .getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
          MediaPlayer mMediaPlayer = new MediaPlayer();
  
          mMediaPlayer.setDataSource(this, alert);
  
          final AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
          if (audioManager.getStreamVolume(AudioManager.STREAM_ALARM) != 0) {
              mMediaPlayer.setAudioStreamType(AudioManager.STREAM_ALARM);
              mMediaPlayer.setLooping(false);
              mMediaPlayer.prepare();
              mMediaPlayer.start();
          }
  </code></pre>
  
  <p>Thanks for any feedback here!</p>
  
  <p>Bex</p>