Android Question Intercept incoming calls

Shay

Well-Known Member
Licensed User
Hi
How do I intercept incoming calls - I tried few examples here, and it is not working, is it related to the new google policies? (I am using galaxy s7)

Thanks
 

Cableguy

Expert
Licensed User
The phone model is not the modt important thing to know, but rather the OS it's running and wthe API you're targeting.
It may be related to the "new" permission policy
 

Shay

Well-Known Member
Licensed User
yes I know, since I am targeting all versions (I have android 8)
 

Shay

Well-Known Member
Licensed User
This is the code i am using in service
B4X:
Sub Process_Globals
    Dim PE As PhoneEvents
    Dim PhoneId As PhoneId

End Sub

Sub Service_Create
    PE.InitializeWithPhoneState("PE",PhoneId)
    Log("Service created")
End Sub

Sub Service_Start (StartingIntent As Intent)
    Log("Service started.")
    'Service.StopAutomaticForeground 'Call this when the background task completes (if there is one)
End Sub

Sub Service_Destroy

End Sub

Sub PE_PhoneStateChanged (State As String, IncomingNumber As String, Intent As Intent)
    Log("PhoneStateChanged, State = " & State & ", IncomingNumber = " & IncomingNumber)
    Log(Intent.ExtrasToString)
    ToastMessageShow(IncomingNumber,False)
End Sub
 

Shay

Well-Known Member
Licensed User
Tried, still not good, it is not recognizing the PE_PhoneStateChanged
do I need to modification to the mainfest?
I tried this:
AddPermission(android.permission.READ_PHONE_STATE)
 
Top