BroadcastReceiver

XverhelstX

Well-Known Member
Licensed User
Longtime User
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?

Tomas

Sent from my SE Xperia Play using Tap atalk.
 
Upvote 0

XverhelstX

Well-Known Member
Licensed User
Longtime User
I never thought I'd succeed in this. :eek:
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


Tomas
 

Attachments

  • AnswerCall.zip
    9.5 KB · Views: 353
Last edited:
Upvote 0
Top