I use TYPE_NOTIFICATION, but the appart from the fact that my code was more or less exactly the same.
I found that playing sound inside a new handler helped in my case:
Uri currentUri = RingtoneManager.getActualDefaultRingtoneUri(
this.context, RingtoneManager.TYPE_RINGTONE);
final Ringtone ringtone = RingtoneManager.getRingtone(this.context,
currentUri);
if (ringtone != null) {
new Handler().post(new Runnable() {
@Override
public void run() {
ringtone.play();
}
});
}
Why did this solve the problem?
, RingtoneManager , , / , .
, , .
, : post?