Android Question Is ringtone playing

Jmu5667

Well-Known Member
Licensed User
Longtime User
Hi All

Android 5.1 has caught me out play ringtone using the media player, direct file access is no longer supported.

I have setup a timer to manage this now, but I need to check if the ringtone is currently being played as I need to loop the ringtone as I was doing using mediaplayer

B4X:
Sub IsRingtonePlaying() As Boolean
   
  Dim jo As JavaObject
  jo.InitializeStatic("android.media.Ringtone")
  Return jo.RunMethod("isPlaying",Null)
   
End Sub

The about code does not work, please help :)

Regard John.
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

Jmu5667

Well-Known Member
Licensed User
Longtime User
The user selected the ringtone that they want to use as an alert notification sound. I was using media player to loop the sound playback, but this is not allowed in Android 5.1 anymore. I have already change the code to play the selected ringtone, but I need to check when it finished playing so I can loop it until the user cancels the notification.
 
Upvote 0
Top