I think the problem in broadcastreceiver is the onreceive method. The onreceive method in java raises a B4A sub . This is why i think that the actual code should be in the java code rather than in the raised thread. Can anyone confirm this?
I never thought I'd succeed in this.
I didn't had to use "android.intent.action.ANSWER" but the internal ITTelephony class together with Erel's PhoneEvents library.
It may not work on all devices (if you can test it out?)
It worked for my Xperia PLAY.
Note that you should respect the order of events of the sample in phonestateChanged and that it will only work in a service.
B4X:
Sub PE_PhoneStateChanged (State As String, IncomingNumber As String, Intent As Intent)
Log("PhoneStateChanged, State = " & State & ", IncomingNumber = " & IncomingNumber)
Log(Intent.ExtrasToString)
AC.LetPhoneRing(3000)
If AC.isRinging == True Then
AC.AnswerPhone
End If
AC.enableSpeakerphone
End Sub