Hello,
With this code I can recover audio focus (sdk 30). But how do you abandon the audio focus?
This code does not work :
jo.RunMethod("abandonAudioFocus", Array(event)) or jo.RunMethod("abandonAudioFocusRequest", Array(event))
I need to create an AudioFocusRequest with AudioFocusRequest.Builder but I have no java knowledge to do it in B4A.
Someone can help me ?
Thanks for your help.
With this code I can recover audio focus (sdk 30). But how do you abandon the audio focus?
This code does not work :
jo.RunMethod("abandonAudioFocus", Array(event)) or jo.RunMethod("abandonAudioFocusRequest", Array(event))
I need to create an AudioFocusRequest with AudioFocusRequest.Builder but I have no java knowledge to do it in B4A.
Someone can help me ?
Thanks for your help.
Dim jo As JavaObject
jo.InitializeContext
jo = jo.RunMethod("getSystemService", Array("audio"))
Dim event As Object = jo.CreateEventFromUI("android.media.AudioManager.OnAudioFocusChangeListener", "audio", Null)
Dim p As Phone
jo.RunMethod("requestAudioFocus", Array (event, p.VOLUME_MUSIC, 2))) '2 = AUDIOFOCUS_GAIN_TRANSIENT