Android: How can I include a Notification Sound using a Sound Resource?

Looking at the developer documentation, I see how to use the default sound and how to use a Uri, but I don’t see how to use a resource. How can I use one of the sounds in my res/raw folder? Such as an MP3 or WAV file?

Answer

Uri path = Uri.parse("android.resource://[package]/[res id]");

Example:

Uri path = Uri.parse("android.resource://com.mypackage/"+R.raw.mysound_1);