Jmu5667 Well-Known Member Licensed User Longtime User Aug 26, 2015 #1 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 Code: 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.
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 Code: 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 Aug 26, 2015 #2 Why not use the mediaplayer object???? https://www.b4x.com/android/forum/threads/mediaplayer-tutorial.6591/#content Upvote 0
Why not use the mediaplayer object???? https://www.b4x.com/android/forum/threads/mediaplayer-tutorial.6591/#content
Jmu5667 Well-Known Member Licensed User Longtime User Aug 26, 2015 #3 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
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.
Erel B4X founder Staff member Licensed User Longtime User Aug 26, 2015 #4 You can use the code I posted here to get the ringtone and play it: https://www.b4x.com/android/forum/threads/default-message-sound.56476/#post-355337 You need to get the ringtone object and then you will be able to call isPlaying with JavaObject. Upvote 0
You can use the code I posted here to get the ringtone and play it: https://www.b4x.com/android/forum/threads/default-message-sound.56476/#post-355337 You need to get the ringtone object and then you will be able to call isPlaying with JavaObject.