Android Question Updating SQLite file on a device

aklisiewicz

Active Member
Licensed User
Longtime User
I understand it is quite easy to install SQLite database along with the application. My question here is about a manual update. Another words I would like to be able to copy file to the device manually.
Here is a scenario:
1. User installed the App along with the database (ie.e MyData.db file)
2. User was given newer version of the file and needs to copy that file to the device from PC
a) using USB connection (probably the easiest)
b) using WiFi
c) using BlueTooth​

Assuming the first method to be the easiest, I would like to ask where the particular file needs to be copied in order to be replaced with the old one ? Is it enough to copy the file to the device to particular folder, or I need to do something else ?

Arthur
 

stevel05

Expert
Licensed User
Longtime User
It sounds like it's a static database, as in, the user does not update it. In which case the easiest way to update it would be to release a new version of the app with the new database included, then just copy it to wherever it needs to be within your code. No user intervention required,

If you want to do it manually, the location will depend on where you are accessing the database from within your app.
 
Upvote 0

aklisiewicz

Active Member
Licensed User
Longtime User
Steve - thank you for your time.

I do not want to run the installation every time the database has changed and needs to be updated.
Initially I just want the user to be able to download the database to the PC, connect the device through USB and copy the database file manually (drag and drop). The only question is where to drop it ?
So far I have no preferences where to store dB file on the devices, although storing on device internal memory would be preferred. I'm still little confused about DirInternal and DirExternal parameters. At this point for simplicity the dB filename and path will be fixed either on the device and on PC as well.
Are there any examples of something like that ?
Arthur
 
Upvote 0

derez

Expert
Licensed User
Longtime User
If you want access to the directory of the DB, the easiest place is DirRootExternal & "/[dir name]" where dir name will be your program name or something which can be identified easily by a user.
The problem is that the DirRootExternal may have different names in devices, like sdcard, sdcard0 or other names. Solution for this is to create a simple installation app just for the DB, to copy it from the Assets to the above directory (or if you trust the user to find it by the dir name - let him search).
 
Upvote 0
Top