I seem to be having a bit of a problem with the execution of this code which is in my service:
I'm using it so I know if any media like a video or music is playing. If media is not playing it returns false and if the media is playing it returns true. All might seem well but if I call again it after the media has finished playing, it will not return any value. I found out that was happening by using this coding.
In that case, the toast is not showing anything. Not even a blank toast. The only way to get everything cleared and working again is to run the app and exit it.
Is there a way to refresh the JavaObject so it always returns a value?
Thanks.
B4X:
Sub IsStreamActive(Stream As Int) As Boolean
Dim jo As JavaObject
Return jo.InitializeStatic("android.media.AudioSystem").RunMethod("isStreamActive", _
Array(Stream, 0))
End Sub
I'm using it so I know if any media like a video or music is playing. If media is not playing it returns false and if the media is playing it returns true. All might seem well but if I call again it after the media has finished playing, it will not return any value. I found out that was happening by using this coding.
B4X:
ToastMessageShow(IsStreamActive(3), False)
In that case, the toast is not showing anything. Not even a blank toast. The only way to get everything cleared and working again is to run the app and exit it.
Is there a way to refresh the JavaObject so it always returns a value?
Thanks.