I would like to add a datafile (SQL file) to my app so the user can lookup (address) data from the database. This file needs to available on the first startup. Afterwards the user needs to be able to change the file.
How can I include a file in the final APK, and have it extracted when the APK is installed?
Add a copy of your db to your project .. click on the Files Tab (see image)
Then ...
B4X:
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
If File.Exists(File.DirInternal, "Database.db") = False Then 'or (File.DirDefaultExternal,
File.Copy(File.DirAssets, "Database.db", File.DirInternal, "Database.db")
End
then use this path for all future read / writes... (File.DirInternal, "Database.db")
Add a copy of your db to your project .. click on the Files Tab (see image)
Then ...
B4X:
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
If File.Exists(File.DirInternal, "Database.db") = False Then 'or (File.DirDefaultExternal,
File.Copy(File.DirAssets, "Database.db", File.DirInternal, "Database.db")
End
then use this path for all future read / writes... (File.DirInternal, "Database.db")