4

I can't play a ringtone once even if mediaplayer looping property is set to false. It looks like this property was overriden by the ringtone URIused. So onCompletion is never fired.

Curiously, if the URI corresponds to a notification tone, looping behaves according to setLooping. It works well here.

So is there a way to play a ringtone once?

HitOdessit
  • 7,198
  • 4
  • 36
  • 59
fruh
  • 53
  • 1
  • 8

1 Answers1

0

I faced this problem before and solved it by using OnSeekCompleteListener:

mMediaPlayer.setOnSeekCompleteListener(new OnSeekCompleteListener() { public void onSeekComplete(MediaPlayer mp) { //Your stuff }});

I don't know if it's the best way to solve this, but it worked for me.

Edit: BTW, I use both listeners, oncompletionlistener AND onseekcompletelistener. Hope this helps!

BCS
  • 11
  • 4