Android Question PERMISSION_READ_CALL_LOG - sdk=26 - Android 8

petr4ppc

Well-Known Member
Licensed User
Longtime User
Dear friends, please for advice:

I am using:
B4X:
Dim myCallLog As CallLog
Dim myList As List
Dim myitem As CallItem
myList = myCallLog.GetAll(0)
with myphone.sdkversion=26, Android 8

I have not this app in google play. I have only my own instalation.

I get error:
java.lang.SecurityException: Permission Denial: opening provider com.android.providers.contacts.CallLogProvider from ProcessRecord{3d87bd0 8097:mm2.app.mobile/u0a202} (pid=8097, uid=10202) requires android.permission.READ_CALL_LOG or android.permission.WRITE_CALL_LOG

I am using this permission:
B4X:
rp.CheckAndRequest(rp.PERMISSION_READ_CALL_LOG)
                                        wait for Activity_PermissionResult(permission As String, result As Boolean)
                                        If result=True Then
                                            '-----------CALL LOG
                                                Dim myCallLog As CallLog
                                                Dim myList As List
                                                Dim myitem As CallItem
                                                myList = myCallLog.GetAll(0)
                                        End If
In Manifesteditor i have:
B4X:
AddPermission(android.permission.READ_CALL_LOG)

The trouble is Google, my Phone or my code, please?
Thank you
p4ppc
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
This code works properly here:
B4X:
Sub Process_Globals
   Private rp As RuntimePermissions
   Private HavePermission As Boolean
End Sub

Sub Globals

End Sub

Sub Activity_Create(FirstTime As Boolean)
   HavePermission = True
   For Each permission As String In Array(rp.PERMISSION_READ_CALL_LOG, rp.PERMISSION_READ_CONTACTS)
       rp.CheckAndRequest(permission)
       wait for Activity_PermissionResult(permission As String, result As Boolean)
       If result=False Then
           HavePermission = False
           Exit   
       End If
   Next
   If HavePermission Then
       Dim myCallLog As CallLog
       Dim myList As List
       Dim myitem As CallItem
       myList = myCallLog.GetAll(0)
   End If
End Sub
 
Upvote 0
Top