Greetings,
I'm currently using this coding to detect when the phone state changes when the phone app is on a phone call. Is there something like it to detect when audio from another app starts playing? I want to use the same type of coding to mute the exoPlayer volume as soon as another app wether it's a video or other audio starts playing.
I'm currently using this coding to detect when the phone state changes when the phone app is on a phone call. Is there something like it to detect when audio from another app starts playing? I want to use the same type of coding to mute the exoPlayer volume as soon as another app wether it's a video or other audio starts playing.
Process_Globals:
Private PE As PhoneEvents
Private PhoneId As PhoneId
B4X:
Sub InitializeObjects
PE.InitializeWithPhoneState("PE",PhoneId)
End Sub
B4X:
Sub PE_PhoneStateChanged (State As String, IncomingNumber As String, Intent As Intent)
If kvs.Get("SoundIsOn") = True Then
If State = "IDLE" Then
exoPlayer.Volume = kvs.Get("MasterVolume")
Else
exoPlayer.Volume = 0
End If
End If
End Sub