1.Create 1 folder named raw under the name yourApp / res /
2. Copy and paste your ringtone into this folder
3. Write down the code below when your application notifies you.!
SoundPool sp = new SoundPool(5, AudioManager.STREAM_MUSIC, 0);
int iTmp = sp.load(context, R.raw.windows_8_notify, 1);
sp.play(iTmp, 1, 1, 0, 0, 1);
MediaPlayer mPlayer = MediaPlayer.create(context, R.raw.windows_8_notify);
mPlayer.start();
source
share