B4A v8.3 following the thread:https://www.b4x.com/android/forum/threads/endless-loop-in-check-permission.95015/ I arrived here:
The following code works ok when compiled in debug mode, prompting for the permission and returning true when accepting in the prompting dialog.
In Release mode nothing (requesting permission) is shown and false is returned.
Same results in both a lenovo android v6.01 and an lineageOS android 8.1
In applications permissions in Settings, no permissions where requested for this app. Compiled in debug mode and answering "yes" in the permission request prompt, this can change to yes for accessing external storage.
The manifest:
Any support is welcome
The following code works ok when compiled in debug mode, prompting for the permission and returning true when accepting in the prompting dialog.
In Release mode nothing (requesting permission) is shown and false is returned.
Same results in both a lenovo android v6.01 and an lineageOS android 8.1
In applications permissions in Settings, no permissions where requested for this app. Compiled in debug mode and answering "yes" in the permission request prompt, this can change to yes for accessing external storage.
B4X:
#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#BridgeLogger: True
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim rr As RuntimePermissions
Dim all As Int
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
all=0
End Sub
Sub Activity_Resume
If all =0 Then CallSubDelayed(Me,"soupa")
End Sub
Sub soupa
all=all+1
rr.CheckAndRequest(rr.PERMISSION_READ_EXTERNAL_STORAGE)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
Log("perm: "&Result)
If Result Then all=all+1
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
The manifest:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="26"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
CreateResourceFromFile(Macro, Themes.DarkTheme)
'End of default text.
AddPermission(android.permission.PERMISSION_READ_EXTERNAL_STORAGE)
Logger connected to: LENOVO Lenovo TB2-X30F
--------- beginning of crash
--------- beginning of system
--------- beginning of main
Logger connected to: LENOVO Lenovo TB2-X30F
--------- beginning of crash
--------- beginning of system
--------- beginning of main
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
sending message to waiting queue (activity_permissionresult)
running waiting messages (1)
perm: false
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
Logger connected to: OnePlus A0001
--------- beginning of system
--------- beginning of main
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
sending message to waiting queue (activity_permissionresult)
running waiting messages (1)
perm: false
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
Any support is welcome