title: Android alarm clock sound using the alarm volume setting?
body: <p>I am trying to build a custom type of alarm clock for Android, and I have set up a settings page to allow the users to choose which alarm sound they would like to use. After they select it, it is placed into SharedPreferences, easy enough.</p>
  
  <p>The problem I am having is how to play the alarm they have chosen, while using the RingtoneManager.TYPE_ALARM, so that the volume is based off the systems alarm sound instead of the systems notification volume.</p>
  
  <p>I have tried multiple ways to even get it to use the Alarm volume, but nothing seems to be doing the trick.</p>
  
  <p><strong>1.</strong></p>
  
  <pre><code>Uri currentRingtoneUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM);
  currentRingtone = RingtoneManager.getRingtone(context, currentRingtoneUri);
  currentRingtone.play();
  </code></pre>
  
  <p><strong>2.</strong></p>
  
  <pre><code>SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
  String syncConnPref = sharedPref.getString("alarm_new_alarm_sound", null);
  
  if (syncConnPref != null) {
    RingtoneManager.getRingtone(this, Uri.parse(syncConnPref)).play();
  }
  </code></pre>
  
  <p>I cannot seem to find any other direct ways of playing the actual alarm volume sound. Everything online looks at just playing ringtones.</p>
  
  <p>I would really appreciate if anyone had any insight on using the alarm volume.</p>