Android Question renames the db with .bak extension

Roberto P.

Well-Known Member
Licensed User
Longtime 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
 
Code: Copy
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:
Upvote 0
How long are you here, ha?
USE CODE TAGS WHEN POSTING CODE!
 
Upvote 0
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
 
Upvote 0
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
 
Upvote 0
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
 
Upvote 0
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
 
Upvote 0
Hi Roberto,
My destination folders are not readonly.
Do you make the dbase externally?
Can you make a stripped app for testing?
 
Upvote 0
yes, I create db externally and never had problems!
 
Upvote 0
Do you use DBUtils lib in your app?
Would you try this with your own db dir and name to look if it works?

Code: Copy
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
 
Upvote 0
Back
Top