Having in the manifest file targetsdkversion=26, I am going to use RuntimePermissions that B4A has....
I have an activity and I want to have the "PERMISSION_READ_EXTERNAL_STORAGE" or any other dangerous permission just after activity loading, before user starts interaction with the activity.
I put the following code in activity_resume:
and I have also:
When I compile it as Debug, it runs, it shows the dialog requesting the permission.
When I complie it as Release, it runs, and enters in an endeless loop without shown the dialog requesting the permission.
When I put the above code in Activity_create there is not an endless loop in release mode but the result is false without showing the dialog requesting permission to the user. It just return false. In debug mode, it works ok.
My main problem is that the dialog requesting the permision is not shown in the release mode. I have to add that, the application in Settings has not a past answer kept denying the permission.
An other problem, is the following case:
Having an activity that starts and based on the Intent probably we need to request a dangerous permission. In such a case, the need starts inside the Activity_resume.
I was thinking to divide the "algorithm" inside the activity _resume in two parts:
a) code running inside the Activity_resume
b) From activity_resume, if needed, call with callsubdelayed a second sub to request the permission, after activity_resume is finished and activity is shown. Based on the result of the checkandrequest continue the algorithm through this sub.
What is your opinion?
I am stuck with the above with no results
Any ideas?
Previous questions on the subject:
https://www.b4x.com/android/forum/threads/runtimepermissions-request-for-permission-not-shown.95042/
https://www.b4x.com/android/forum/threads/endless-loop-in-check-permission.95015/
I have an activity and I want to have the "PERMISSION_READ_EXTERNAL_STORAGE" or any other dangerous permission just after activity loading, before user starts interaction with the activity.
I put the following code in activity_resume:
B4X:
Sub Activity_Resume
rr.CheckAndRequest(rr.PERMISSION_READ_EXTERNAL_STORAGE)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
Log("perm: "&Result)
End Sub
B4X:
Sub Process_Globals
Dim rr As RuntimePermissions
End Sub
When I compile it as Debug, it runs, it shows the dialog requesting the permission.
When I complie it as Release, it runs, and enters in an endeless loop without shown the dialog requesting the permission.
When I put the above code in Activity_create there is not an endless loop in release mode but the result is false without showing the dialog requesting permission to the user. It just return false. In debug mode, it works ok.
My main problem is that the dialog requesting the permision is not shown in the release mode. I have to add that, the application in Settings has not a past answer kept denying the permission.
An other problem, is the following case:
Having an activity that starts and based on the Intent probably we need to request a dangerous permission. In such a case, the need starts inside the Activity_resume.
I was thinking to divide the "algorithm" inside the activity _resume in two parts:
a) code running inside the Activity_resume
b) From activity_resume, if needed, call with callsubdelayed a second sub to request the permission, after activity_resume is finished and activity is shown. Based on the result of the checkandrequest continue the algorithm through this sub.
What is your opinion?
I am stuck with the above with no results
Any ideas?
Previous questions on the subject:
https://www.b4x.com/android/forum/threads/runtimepermissions-request-for-permission-not-shown.95042/
https://www.b4x.com/android/forum/threads/endless-loop-in-check-permission.95015/
Last edited: