It basically uses an SQLite db which I update. Rather than update the app every few months how can I get it to download and use latest db version rather than upload new versions
I can host the new db on my website - how to download and update the current sqlite db
There are a lot of approach here in B4X to do it.
To exactly fit your app needs you should specify what db update type you mean: insert records, update/delete records, change schema or mix of them? also your db size matter.
You have a lot of choice in b4x such as okhttp, mqtt, etc .....
Size of db is less than 5 MB
I think it would update about 100 each time some new and some update but in reality easiest to replace one db file with the other
Here Dr. Declan:
In this case use okhttp library as the following:
1- Check OkHttpUtils2 library
2- Use this example to download your x.db file.
3- replace your old.db with your new.db using file functions.
I'm happy to assist you Dr. Declan, I downloaded your app , it is amazing & has a lot of medical info suitable for almost of doctors in any level of medical study or practice.
By the way I'm MBBS in medicine, I'm glade to assist you in your app if you need adjustment, improvement or any thing. I can help.
1-if new field or new table is added to db :
you can add that with code to old database.you must put codes in new Update apk.
example :
B4X:
Try
' Add new columns to the database if they don't already exist
Main.Sql1.ExecNonQuery("ALTER TABLE [tablename] ADD [fieldname] integer default 1")
Catch
Log(LastException)
End Try
B4X:
'creat New table in old db
Try
Main.Sql1.ExecNonQuery("CREATE TABLE Tablename (id integer NOT NULL PRIMARY KEY AUTOINCREMENT,name text)")
Catch
Log(LastException)
End Try
2-if new data added to you database
you can download data from server with okhttputils and insert to olddatabase.
===================================
also you can download new db and replace with old db