title: How can I access the audio 'Priority Mode' on a device running Android 5.0?
body: <p>Android 5.0 includes a new way to control which apps are allowed to make noise on your device: when you press the volume button, the popup now lets you to choose <strong>None</strong> (completely silent), <strong>Priority</strong> (only priority notifications make sound), or <strong>All</strong> (everything is allowed to make noise.)</p>
  
  <p><img src="https://i.stack.imgur.com/2c0hK.jpg" alt="New &#39;priority mode&#39; controls in Android 5.0"></p>
  
  <p>I would like my app to be able to query the device to find out which of these three modes is currently active, and also I would like to be able to change these modes (without requiring the device to be rooted).   Does anyone know how to do this?</p>
  
  <p>So far, all I can find is a brief reference <a href="https://developer.android.com/about/versions/android-5.0-changes.html" rel="noreferrer">on this changelog</a>:</p>
  
  <blockquote>
    <p>Setting the device to RINGER_MODE_SILENT causes the device to enter the new priority mode. The device leaves priority mode if you set it to RINGER_MODE_NORMAL or RINGER_MODE_VIBRATE.</p>
  </blockquote>
  
  <p>This works as described, which allows me a very limited ability to change "priority mode" by modifying the <a href="http://developer.android.com/reference/android/media/AudioManager.html#setRingerMode(int)" rel="noreferrer">ringer mode in AudioManager</a>.  That's not enough, though, as I need to be able to know exactly which of the three priority mode settings is currently active, and it would also be nice if I could change them more precisely than AudioManager allows.</p>