Pause Mediaplayer when phone rings

sarim123

Member
Licensed User
Longtime User
Hello Everyone!

Does anyone know how to pause the media player or stop the app (either one) when the phone starts ringing?
I currently have tried this and it doesn't work. The mediaplayer keeps playing.

B4X:
Sub PhoneStateChanged (State As String, IncomingNumber As String, Intent As Intent)
'use parameters:OFFHOOK and RINGING
   If State="OFFHOOK" OR State="RINGING" Then
      Activity.Finish
      ExitApplication
   End If
End Sub

Thank you!!!!!
 
Top