D DeclanOK Member Licensed User May 23, 2022 #1 I have an app https://play.google.com/store/apps/details?id=com.pocketmednotes2014.secondapp&hl=en_GB 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 Thanks Declan
I have an app https://play.google.com/store/apps/details?id=com.pocketmednotes2014.secondapp&hl=en_GB 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 Thanks Declan
H Hamied Abou Hulaikah Well-Known Member Licensed User Longtime User May 23, 2022 #2 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 ..... Upvote 0
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 .....
D DeclanOK Member Licensed User May 23, 2022 #3 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 Upvote 0
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
H Hamied Abou Hulaikah Well-Known Member Licensed User Longtime User May 23, 2022 #4 DeclanOK said: 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 Click to expand... 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. Upvote 0
DeclanOK said: 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 Click to expand... 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.
D DeclanOK Member Licensed User May 23, 2022 #5 I am so grateful. Thank you for your kindness. The app is very popular and this saves me time in having to do updates. Upvote 0
I am so grateful. Thank you for your kindness. The app is very popular and this saves me time in having to do updates.
H Hamied Abou Hulaikah Well-Known Member Licensed User Longtime User May 23, 2022 #6 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. Thank you Upvote 0
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. Thank you
behnam_tr Active Member Licensed User Longtime User May 23, 2022 #7 I'm using this way in our app 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: Copy 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: Copy '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 Last edited: May 24, 2022 Upvote 0
I'm using this way in our app 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: Copy 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: Copy '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