Android Question Android 14. How handle permissions

Juan Vargas (Bioagro)

Member
Licensed User
I have been looking for this without luck. My app keep showing a blank screen in the activity create, is a permission related but I have not specific messages, so I don't know where to begin
here is my activity create
Any help would be appreciated

Activity Create:
Sub Activity_Create(FirstTime As Boolean)
    Dim r As Reflector
    Dim Api As Int
    Api = r.GetStaticField("android.os.Build$VERSION", "SDK_INT")
    FacturasPagar.Initialize
    ANDROIDVERSION = Api

    If Api > 22 And (rp.Check(rp.PERMISSION_ACCESS_FINE_LOCATION) = False Or _
                     rp.Check(rp.PERMISSION_READ_EXTERNAL_STORAGE) = False Or _
                     rp.Check(rp.PERMISSION_CAMERA) = False Or _
                     rp.Check(rp.PERMISSION_READ_CONTACTS) = False Or _
                     rp.Check(rp.PERMISSION_READ_PHONE_STATE) = False)  Then
        MsgboxAsync("Para continuar, por favor acepte los siguientes permisos" & CRLF & "To continue, pleace ALLOW the following permissions", "Permissions")
        Wait For Msgbox_Result (Resultx As Int)
        
        rp.CheckAndRequest(rp.PERMISSION_READ_EXTERNAL_STORAGE)
        Wait For Activity_PermissionResult(permission As String, Result As Boolean)
        If Result = False Then
            Log("PERMISSION_READ_EXTERNAL_STORAGE negada")
            Return
        End If

        rp.CheckAndRequest(rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
        Wait For Activity_PermissionResult(permission As String, Result As Boolean)
        If Result = False Then
            Log("PERMISSION_WRITE_EXTERNAL_STORAGE negada")
            Return
        End If

        rp.CheckAndRequest(rp.PERMISSION_CAMERA)
        Wait For Activity_PermissionResult(permission As String, Result As Boolean)
        If Result = False Then
            Log("PERMISSION_CAMERA negada")
            Return
        End If
        rp.CheckAndRequest(rp.PERMISSION_READ_CONTACTS)
        Wait For Activity_PermissionResult(permission As String, Result As Boolean)
        If Result = False Then
            Log("PERMISSION_CONTACTS negada")
        End If
        rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
        Wait For Activity_PermissionResult(permission As String, Result As Boolean)
        If Result = False Then
            Log("PERMISSION_ACCESS_FINE_LOCATION negada")
        End If
        rp.CheckAndRequest(rp.PERMISSION_READ_PHONE_STATE)
        Wait For Activity_PermissionResult(permission As String, Result As Boolean)
        If Result = False Then
            Log("PERMISSION_READ_PHONE_STATE negada")
        End If

    End If
    TouchImageView1.Initialize("TouchImageView1")

    StateManager.RestoreState(Activity, "Main", 60)
    EXPIRADO = False
    If FirstTime Then
        InitializeObjetos
        If InitializeDatabase = True Then
            If File.Exists(Folder, "back0.jpg") = False Then
                File.Copy(File.DirAssets,"backdefault0.jpg",Folder,"back0.jpg")
            End If
            If File.Exists(Folder, "back1.jpg") = False Then
                File.Copy(File.DirAssets,"backdefault1.jpg",Folder,"back1.jpg")
            End If
            FolderImagesLogo = f.GetPicturesFolder & "/images_logo"
            If File.Exists(FolderImagesLogo, "LOGO_BIOAGR.jpg") = False Then
                File.Copy(File.DirAssets,"LOGO_BIOAGR.jpg",FolderImagesLogo,"LOGO_BIOAGR.jpg")
            End If
            If File.Exists(FolderImagesLogo, "LOGO_AGRODE.jpg") = False Then
                File.Copy(File.DirAssets,"LOGO_AGRODE.jpg",FolderImagesLogo,"LOGO_AGRODE.jpg")
            End If
            If File.Exists(FolderImagesLogo, "LOGO_BIOQLO.jpg") = False Then
                File.Copy(File.DirAssets,"LOGO_BIOQLO.jpg",FolderImagesLogo,"LOGO_BIOQLO.jpg")
            End If
            If File.Exists(FolderImagesLogo, "STAMP_BIOAGR.png") = False Then
                File.Copy(File.DirAssets,"STAMP_BIOAGR.png",FolderImagesLogo,"STAMP_BIOAGR.png")
            End If
            If File.Exists(FolderImagesLogo, "STAMP_AGRODE.png") = False Then
                File.Copy(File.DirAssets,"STAMP_AGRODE.png",FolderImagesLogo,"STAMP_AGRODE.png")
            End If
            If File.Exists(FolderImagesLogo, "STAMP_BIOQLO.png") = False Then
                File.Copy(File.DirAssets,"STAMP_BIOQLO.png",FolderImagesLogo,"STAMP_BIOQLO.png")
            End If

            If NODATABASE = True Then
                Return
            End If
            CROPIMAGE = False
            If ConfigRECORD.USARACCESO = True Then
                ShowLogin
                Return
            End If
            If ConfigRECORD.CIA_NOMBRE.Length = 0 Then
            Else
                ShowMain
            End If
        End If
    End If
End Sub
 
Top