Hello I try to make a runtimepermission class to ask the user some permissions. When I'm in debug mode I have no problem but when I release my application is blocked. This is my code
this part is in the main at the beginning
and this is my class
B4X:
Private RTP As RunTimePermission
RTP.Initialize
wait for (RTP.manager_RunTimePermission) Complete (Resultat As Boolean)
and this is my class
B4X:
Sub Class_Globals
Private RunTimePermissions As RuntimePermissions
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize
End Sub
Sub manager_RunTimePermission As ResumableSub
Dim counter As Int
wait for (RTP_Write_External_Storage) complete (Resultat As Boolean)
If Resultat = True Then
Log("counter = 1")
counter = counter + 1
Else
Log("ntm")
End If
Sleep(1500)
wait for (RTP_Read_External_Storage) complete (Resulta As Boolean)
If Resulta = True Then
Log("counter = 2")
counter = counter + 1
Else
Log("ntm")
End If
Sleep(1500)
wait for (RTP_Coarse_Location) complete (Result As Boolean)
If Result = True Then
Log("counter = 3")
counter = counter + 1
Else
Log("ntm")
End If
Sleep(1500)
wait for (RTP_Fine_Location) complete (Resul As Boolean)
If Resul = True Then
Log("counter = 4")
counter = counter + 1
Else
Log("ntm")
End If
Sleep(1500)
wait for (RTP_Phone_Phone_State) complete (Resu As Boolean)
If Resu = True Then
Log("counter = 5")
counter = counter + 1
Else
Log("ntm")
End If
If counter = 5 Then
Return True
Else
Return False
End If
End Sub
Private Sub RTP_Write_External_Storage As ResumableSub
RunTimePermissions.CheckAndRequest(RunTimePermissions.PERMISSION_WRITE_EXTERNAL_STORAGE)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
If Result = False Then
ToastMessageShow("No permission...", True)
Return False
Else
Return True
End If
End Sub
Private Sub RTP_Read_External_Storage As ResumableSub
RunTimePermissions.CheckAndRequest(RunTimePermissions.PERMISSION_READ_EXTERNAL_STORAGE)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
If Result = False Then
ToastMessageShow("No permission...", True)
Return False
Else
Return True
End If
' Return True
End Sub
Private Sub RTP_Coarse_Location As ResumableSub
RunTimePermissions.CheckAndRequest(RunTimePermissions.PERMISSION_ACCESS_COARSE_LOCATION)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
If Result = False Then
ToastMessageShow("No permission...", True)
Return False
Else
Return True
End If
' Return True
End Sub
Private Sub RTP_Fine_Location As ResumableSub
RunTimePermissions.CheckAndRequest(RunTimePermissions.PERMISSION_ACCESS_FINE_LOCATION)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
If Result = False Then
ToastMessageShow("No permission...", True)
Return False
Else
Return True
End If
' Return True
End Sub
Private Sub RTP_Phone_Phone_State As ResumableSub
RunTimePermissions.CheckAndRequest(RunTimePermissions.PERMISSION_ACCESS_FINE_LOCATION)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
If Result = False Then
ToastMessageShow("No permission...", True)
Return False
Else
Return True
End If
' Return True
End Sub
Sub Activity_PermissionResult (Permission As String, Result As Boolean)
Log(Permission & " = " & Result)
If Result = False Then
Log("False")
ExitApplication
End If
Log(Permission & " = " & Result)
End Sub