Android Question Help required to detect incoming call phone number.

SohailNasir

Member
Licensed User
Longtime User
Hi
I need to develop an application which will identify incoming call number and use this number to process some code. The phone library does not help here. I will be obliged if someone creates a library to handle code easily for incoming call number . Thanks
 

RAJAN MBA

Member
Licensed User
Longtime User
Did you check out phone events?
B4X:
Dim PE As PhoneEvents
Sub PE_PhoneStateChanged (State As String, IncomingNumber As String, Intent As Intent)
Log("PhoneStateChanged, State = " & State & ", IncomingNumber = " & IncomingNumber)
End Sub
 
Upvote 0

SohailNasir

Member
Licensed User
Longtime User
Did you check out phone events?
B4X:
Dim PE As PhoneEvents
Sub PE_PhoneStateChanged (State As String, IncomingNumber As String, Intent As Intent)
Log("PhoneStateChanged, State = " & State & ", IncomingNumber = " & IncomingNumber)
End Sub
Thanks so much for your quick response.
I have seen this but it does not seem to work. I need a complete code or better still a library which should have method like e,g
editview.text = library.incoming number
 
Upvote 0

mangojack

Expert
Licensed User
Longtime User
You are using the Phone Library ..
Did your code produce any Error messages .. or it just 'did not work' .. need more info

Have you read ' similar threads ... Detect Incoming Phone Call ' ... at the top of this thread ?
B4X:
Dim PE AsPhoneEvents

Sub PE_PhoneStateChanged (State As String, IncomingNumber As String, Intent As Intent)
  If State = "RINGING" Then
    EditText1.Text = IncomingNumber
  End If
End Sub
 
Last edited:
Upvote 0

RAJAN MBA

Member
Licensed User
Longtime User
Thanks so much for your quick response.
I have seen this but it does not seem to work. I need a complete code or better still a library which should have method like e,g
editview.text = library.incoming number
I quickly cobbled up code for you. please try the attached code. The incoming number will be shown as toast message.
 

Attachments

  • detectincomingph.zip
    7.9 KB · Views: 1,261
Last edited:
Upvote 0
Top