Android Question Problem using RandomAcessFile 2.33

Roberto M. de Oliveira

Member
Licensed User
My program normally compiles on a Windows 7 32-bit PC, version B4A 9.80.
On a new PC, windows 10 32 bits, I installed the B4A 10.00, according to the installation guidance.
When I compiled the program, the problem described below occurr:

The compilation runs ok! and used AndroidX SDK.

When I run the program an error occurs when reading files (i'm using randomacessfile 2.33, encrypted object). All registers return empty!

Read and Write File routines:
'**********************************************************************************************
' Tratamento de arquivos - Leitura e Gravação
'*********************************************************************************************
Sub LerArquivo(Dados As List,Senha As String,Arquivo As String)
    Dados.Initialize
    RAF.Initialize(File.DirRootExternal, Arquivo, False)
    Dados=RAF.ReadEncryptedObject(Senha, RAF.CurrentPosition)
    RAF.Close
End Sub

Sub GravarArquivo(Dados As List,Senha As String,Arquivo As String)
    RAF.Initialize(File.DirRootExternal, Arquivo, False)
    RAF.WriteEncryptedObject(Dados,Senha, RAF.CurrentPosition)
    RAF.Close
End Sub

Can anyone help solve this bug?
 

DonManfred

Expert
Licensed User
Longtime User

 
Upvote 0

Roberto M. de Oliveira

Member
Licensed User
Hi!, Don

Ok! Thanks your faster answer!

I never run the program under AndroidX SDK.

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="26" android:targetSdkVersion="28"/>
<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.

I included all permissions for files matter:

Permissions:
    'Solicitação de acesso à memoria
    RP.CheckAndRequest(RP.PERMISSION_READ_EXTERNAL_STORAGE)
    Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
    If Permission = RP.PERMISSION_READ_EXTERNAL_STORAGE Then Log("PERMISSION_READ_EXTERNAL_STORAGE = " & Result)
    RP.CheckAndRequest(RP.PERMISSION_WRITE_EXTERNAL_STORAGE)
    Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
    If Permission = RP.PERMISSION_WRITE_EXTERNAL_STORAGE Then Log("PERMISSION_WRITE_EXTERNAL_STORAGE = " & Result)

Have you any other suggestion?
 
Upvote 0

Roberto M. de Oliveira

Member
Licensed User
I did one more test on the program and changed it to use the files (core) structure.

The program started to work normally, but I would like to use encryption.

Can this answer the problem?
 
Upvote 0
Top