Mintoris
Aug 20, 2018, 02:32 AM *
Welcome, Guest.

login

register

Did you miss your activation email?


Login with username, password and session length
News:
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: Overwriting Data Files on Update  (Read 1647 times)
hoyoyo80
Full Member
***
Posts: 66


« on: Apr 23, 2016, 01:12 AM »

Thanks

Can i add something? How can i update certain data files and exclude unwanted files. Since my default apk contain default sqlite db and my staff might have their own added data to the database that later on will be replace by updated apk. Can i choose to exclude the db?
Thanks
Logged
Chuck
Global Moderator
Hero Member
*****
Posts: 1898



« Reply #1 on: Apr 23, 2016, 02:04 AM »

Once your default.db is installed, never modify it. Instead copy it to a new file and use the copy as your initial database. That way your default.db can change at any time, but the default.db file is only used when you want to create a new database.
Logged
hoyoyo80
Full Member
***
Posts: 66


« Reply #2 on: Apr 24, 2016, 08:40 PM »

Hrm.. again chuck?

Let say i have two files in my data files,sqlite.db and entry.html, i compile than export it as zip and then using android studio to create apk.
Let say my staff use my app and started to collect datas and request for change of UI in entry.html, so i altered the entry.html but now how can i update their apps without changing their sqlite.db that already have the data and update only the entry.html.

Thanks Chucks
Logged
Chuck
Global Moderator
Hero Member
*****
Posts: 1898



« Reply #3 on: Apr 24, 2016, 08:54 PM »

In your new updated app change the name of the sqlite.db to something like install.db.

Then in your program at the start say:


if isFile("install.db") then
  if not isFile("sqlite.db") then
    copy "install.db", "sqlite.db"
  endif
  delete "install.db"
endif


The file will only be copied if it does not exist.
Logged
hoyoyo80
Full Member
***
Posts: 66


« Reply #4 on: Apr 25, 2016, 11:27 PM »

Thanks Chuck..that solved it  Grin
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines
Page created in 0.026 seconds with 18 queries.