title: Android: save sound as ringtone and notification
body: <p>I'm saving a sound from my app to be used as a ringtone or a notification sound. Here's part of my code, taken from <a href="http://www.stealthcopter.com/blog/2010/01/android-saving-a-sound-file-to-sd-from-resource-and-setting-as-ringtone/" rel="nofollow">this</a> page:</p>
  
  <pre><code>ContentValues values = new ContentValues();
  values.put(MediaStore.MediaColumns.DATA, k.getAbsolutePath());
  values.put(MediaStore.MediaColumns.TITLE, soundName);
  values.put(MediaStore.MediaColumns.MIME_TYPE, "audio/ogg");
  values.put(MediaStore.Audio.Media.ARTIST, "artist");
  values.put(MediaStore.Audio.Media.IS_RINGTONE, true);
  values.put(MediaStore.Audio.Media.IS_NOTIFICATION, true);
  values.put(MediaStore.Audio.Media.IS_ALARM, true);
  values.put(MediaStore.Audio.Media.IS_MUSIC, false);
  
  Uri uri = MediaStore.Audio.Media.getContentUriForPath(k.getAbsolutePath());
  this.getContentResolver().insert(uri, values);
  </code></pre>
  
  <p>My understanding is that the sound will be saved as well as a ringtone, a notification sound and an alarm, as the flags are all set to "true". At least on the emulator this does work but on the actual device, the sound only shows up in the ringtone list, and I have no idea why.</p>
  
  <p>EDIT: I've tried to investigate further: removing the line with "IS_RINGTONE" won't change anything (in case only one flag can be used at a time), the sound doesn't show up in the list with the notification-sounds.</p>
  
  <p>Any help is appreciated.</p>
  
  <p>Kind regards, Select0r</p>