Android Question Permission: READ_PHONE_NUMBERS

toby

Well-Known Member
Licensed User
Longtime User
My app reads device's phone number, if any, so that user doesn't have to type it manually, which I also hope would deter abuse.
telNumpermissionDialog.jpg


All I need is just the phone number, no more, no less. My app doesn't make or manage phone calls. I make it clear by specifying "READ_PHONE_NUMBERS" permission in both code and manifest.

However the dialog message shown is misleading, not accurate at best, and would discourage users to tap "Allow".

Anyone has any solution for this problem?

TIA

code:
Starter.rp.CheckAndRequest("android.permission.READ_PHONE_NUMBERS")
    Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean)
    If Result Then
    LogColor("phone #=" & ph.GetLine1Number, Colors.red)
    End If
manifest:
AddPermission(android.permission.READ_PHONE_NUMBERS)
 

Attachments

  • getphoneNum.zip
    14.3 KB · Views: 114
Last edited:
Solution
Here is my solution or workaround, which allows me to decide exactly what to be shown. The catch is that user needs to navigate to the app settings and enable Telephone permission.
B4X:
    Do While Starter.rp.Check("android.permission.READ_PHONE_NUMBERS")=False
        csb.Initialize.Append("Please enable Telehone permission for ").Color(xui.Color_Magenta).Append(Application.LabelName).Pop.Append(" at next step in order to retrieve the phone number for you.").PopAll
        Wait For(Dialog.Show(csb, "OK", "", ""))complete(intResult As Int)
        'popup Setting page
        Dim i As Intent
        i.Initialize("", "")
        i.SetComponent("com.android.settings/.Settings")
        StartActivity(i)
    Loop
    LogColor("phone #=" &...

toby

Well-Known Member
Licensed User
Longtime User
Here is my solution or workaround, which allows me to decide exactly what to be shown. The catch is that user needs to navigate to the app settings and enable Telephone permission.
B4X:
    Do While Starter.rp.Check("android.permission.READ_PHONE_NUMBERS")=False
        csb.Initialize.Append("Please enable Telehone permission for ").Color(xui.Color_Magenta).Append(Application.LabelName).Pop.Append(" at next step in order to retrieve the phone number for you.").PopAll
        Wait For(Dialog.Show(csb, "OK", "", ""))complete(intResult As Int)
        'popup Setting page
        Dim i As Intent
        i.Initialize("", "")
        i.SetComponent("com.android.settings/.Settings")
        StartActivity(i)
    Loop
    LogColor("phone #=" & ph.GetLine1Number, Colors.red)
 
Upvote 0
Solution
Top