File.DirInternal OK for read only database?

CidTek

Active Member
Licensed User
Longtime User
Do I need to copy the database to the sd card if it is read only? It is very large and it would be nice not to take up space twice.
 

edgar_ortiz

Active Member
Licensed User
Longtime User
I use the following code:

B4X:
'
      If File.Exists(File.DirDefaultExternal,"dbfile.db3") = False Then
         File.Copy(File.DirAssets,"dbfile.db3",File.DirDefaultExternal,"dbfile.db3")
         Log ("Main.FirstTime -- Database file copied")
      End If
      '
      ' Open the DataBase
      If Routine.Open_DataBase(File.DirDefaultExternal, "dbfile.db3") = True Then

And I never saw in the log: "Database file copied"... so... you can use the database specified in the app.

Regards,

Edgar
 
Upvote 0

CidTek

Active Member
Licensed User
Longtime User
I use the following code:

B4X:
'
        If File.Exists(File.DirDefaultExternal,"dbfile.db3") = False Then
            File.Copy(File.DirAssets,"dbfile.db3",File.DirDefaultExternal,"dbfile.db3")
            Log ("Main.FirstTime -- Database file copied")
        End If
        '
        ' Open the DataBase
        If Routine.Open_DataBase(File.DirDefaultExternal, "dbfile.db3") = True Then

And I never saw in the log: "Database file copied"... so... you can use the database specified in the app.

Regards,

Edgar


I use the same code as well but if you do not need to write to or update the database I'm thinking why bother. I've read that the copy stored in the apk file is still good for read only.
 
Upvote 0
Top