Android Question [SOLVED] - Phone library - PhoneEvents - PhoneStateChanged IncomingNumber is empty

rleiman

Well-Known Member
Licensed User
Longtime User
Greetings,

I'm experimenting with the phone library and noticed that the IncomingNumber string is empty when a call comes in. Is this happening because the phone provider is not sending that information preventing PhoneStateChanged from seeing the phone number?

Here's the coding I used to test it.

B4X:
Sub PE_PhoneStateChanged (State As String, IncomingNumber As String, Intent As Intent)

        Log("Phone state: " & State)
       
        If State = "RINGING" Then
            Log("The incoming number is: " & IncomingNumber)
        Else
        End If
End Sub

Truly,
Emad
 

rleiman

Well-Known Member
Licensed User
Longtime User
Greetings,

I was able to solve the issue. Here's the coding.

In the manifest editor I added this line:
Permissions.Add(Starter.rp.PERMISSION_RECEIVE_SMS)

In the main module Activity_Create sub routine I added these lines:
Permissions.Initialize
Permissions.Add(Starter.rp.PERMISSION_READ_CALL_LOG)
 
Upvote 0

hatzisn

Well-Known Member
Licensed User
Longtime User
What is the version of Android you use?
 
Upvote 0
Top