Sub Activity_Create(FirstTime As Boolean)
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
Log(jo.RunMethod("requestAudioFocus", Array (event, p.VOLUME_MUSIC, 2)))
End Sub
Sub audio_Event (MethodName As String, Args() As Object) As Object
Log("Method: "&MethodName)
If MethodName="onAudioFocusChange" Then
Log("Args(0): "&Args(0))
If Args(0)<0 Then
Phone_Idle = False
player1.Pause()
Else
Phone_Idle = True
Reset_Radio(RadioChannel)
End If
End If
Log("Phone Idle: "&Phone_Idle)
Return Null
End Sub