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 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.