B4X:
Sub Activity_Create(FirstTime As Boolean)
PlayRingtone(rm.GetDefault(rm.TYPE_NOTIFICATION))
End Sub
Sub PlayRingtone(url AsString)
Dim jo As JavaObject
jo.InitializeStatic("android.media.RingtoneManager")
Dim jo2 As JavaObject
jo2.InitializeContext
Dim u As Uri
u.Parse(url)
jo.RunMethodJO("getRingtone", Array(jo2, u)).RunMethod("play", Null)
End Sub
Using the above code, how do I stop the ringtone from playing? I have tried using the following:
B4X:
jo2.RunMethod("stop",Null)
and
B4X:
jo.RunMethodJO("getRingtone", Array(jo2, u)).RunMethod("stop", Null)
But I keep getting an error saying that the stop method could not be found.