Android Question renames the db with .bak extension

Roberto P.

Well-Known Member
Licensed User
I installed my app on a tablet that renames the db with .bak extension and create a new db empty! It 'happened to anyone? What can it be?
Thank You
 

Roberto P.

Well-Known Member
Licensed User
B4X:
CopyFileFromAssetToInternal(sDBName)
    
    sDBRoot    =    GetTargetInternalDir
 
  m_DB.Initialize(sDBRoot, sDBName)


Sub CopyFileFromAssetToInternal(aFileName As String) As Boolean
 
    Dim TargetDir As String
 
    TargetDir = GetTargetInternalDir
     
    If File.Exists(TargetDir, aFileName) = False Then
        File.Copy(File.DirAssets, aFileName, TargetDir, aFileName)
    End If
 
End Sub

Sub GetTargetInternalDir() As String
 
    Dim TargetDir As String
 
    If File.ExternalWritable Then
        TargetDir = File.DirDefaultExternal
    Else  
        TargetDir = File.DirInternal
    End If 

    Log("Storage Internal Dir: " & TargetDir)
    Return TargetDir

End Sub
The problem occurred with Tablet Galax II and OS 4.22.
Here is the code
 
Last edited:

Roberto P.

Well-Known Member
Licensed User
the problem occurs only with the tablet: I do not know if it's a problem I know the version of O.S. or more. I tried deleting the file, copy it by hand but the problem occurs when launching the app db is renamed
thanks
 

Reviewnow

Active Member
Licensed User
Have you tried an alternate database file with the same end result ?
is it possible that your database is corrupt?
try recreating the database and table structure with no data and see if you get the same result

Just a few suggestions
Good Luck
 

Roberto P.

Well-Known Member
Licensed User
Have you tried an alternate database file with the same end result ?
is it possible that your database is corrupt?
try recreating the database and table structure with no data and see if you get the same result

Just a few suggestions
Good Luck
I've tried everything! I think it's a problem of version SqlLite or tablet's operating system.
I can not understand how it is possible!
thank you
 

Roberto P.

Well-Known Member
Licensed User
hello parijs
I thank you for the feedback.
And 'normal that the destination folder is readonly? Or the problem is the version of SqlLite?
Thank You
 

parijs

Active Member
Licensed User
Hi Roberto,
My destination folders are not readonly.
Do you make the dbase externally?
Can you make a stripped app for testing?
 

Roberto P.

Well-Known Member
Licensed User
yes, I create db externally and never had problems!
 

parijs

Active Member
Licensed User
Do you use DBUtils lib in your app?
Would you try this with your own db dir and name to look if it works?

B4X:
If File.Exists(File.DirRootExternal, "Transmis/trasmis.db") = False Then
File.MakeDir(File.DirRootExternal,"Transmis")
File.Copy(File.DirAssets,"trasmis.db", File.DirRootExternal, "Transmis/trasmis")
End If
 
Top