Hi all,
I don't know why rp.CheckAndRequest(Permission) works for
Permissions.Add(rp.PERMISSION_READ_EXTERNAL_STORAGE)
Permissions.Add(rp.PERMISSION_ACCESS_FINE_LOCATION)
and doesn't work for
Permissions.Add(rp.PERMISSION_READ_PHONE_STATE)
Permissions.Add(rp.PERMISSION_CALL_PHONE)
I mean this,
Thanks in advance
I don't know why rp.CheckAndRequest(Permission) works for
Permissions.Add(rp.PERMISSION_READ_EXTERNAL_STORAGE)
Permissions.Add(rp.PERMISSION_ACCESS_FINE_LOCATION)
and doesn't work for
Permissions.Add(rp.PERMISSION_READ_PHONE_STATE)
Permissions.Add(rp.PERMISSION_CALL_PHONE)
I mean this,
B4X:
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim rp As RuntimePermissions
Dim numPermission As Int
Dim noPermission As Int
Dim Permissions As List
End Sub
Sub Activity_Create(FirstTime As Boolean)
Dim i As Int
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
Permissions.Initialize
Permissions.Add(rp.PERMISSION_READ_PHONE_STATE)
Permissions.Add(rp.PERMISSION_CALL_PHONE)
Permissions.Add(rp.PERMISSION_READ_EXTERNAL_STORAGE)
Permissions.Add(rp.PERMISSION_ACCESS_FINE_LOCATION)
numPermission = 0
noPermission = 0
Do While (numPermission < (Permissions.Size-1))
For i=0 To Permissions.Size-1
Dim Permission As String = Permissions.Get(i)
If Not(rp.Check(Permission)) Then
rp.CheckAndRequest(Permission)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
If Result Then
numPermission = numPermission + 1
noPermission = noPermission - 1
Else
noPermission = noPermission + 1
Msgbox("No Permission: " & Permission,Application.LabelName)
If noPermission = (Permissions.Size) Then
ExitApplication
End If
End If
End If
Next
Loop
Msgbox("Ok",Application.LabelName)
End Sub
Thanks in advance