Reputation: 1
How i create a simple notification alarm sound with my alarm.mp3 file?My file is inside /res/raw directory.What code i need?
notification.sound = Uri.parse("android.resource://" + context.getPackageName() "/" + R.raw.alarm );
Upvotes: 0
Views: 1459
Reputation: 10856
put mp3 file in raw folder inside res. and use below code.
notification.sound = Uri.parse("android.resource://"+context.getPackageName()+"/"+R.raw.your_sound_file_name);
Upvotes: 2
Reputation: 6115
you can use simply following code
notification.sound = Uri.parse("android.resource://" + this.getPackageName() + "/" + R.raw.mySound );
Upvotes: 1