I have a very general question regarding the update procedure of Android apps. Imagine I am publishing a game including different levels and a sql file that stores the highscore and the progress of the player. As far as I understood, uploading a new .apk file to the Google Playstore would completely replace the app previously installed and this would also include the sql file with the player information. This would result in the loss of the player's highscore and in-game progress. I know that the creation of an online player account and storing the data in an external database would be a solution but this is a lot of work.
Is there an easier way to update an app without loosing important player information ?
How would you update a mobile app?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Livecode Opensource Backer
- Posts: 328
- Joined: Mon Dec 05, 2011 5:34 pm
- Contact:
Re: How would you update a mobile app?
Hi,
Just save the sql file in the user "documents" folder on the device. That folder should be away from the actual App and therefore not overwritten with an update.
It's actually quite easy to do. Use the "specialFolderPath" to point at the right place (look it up in the dictionary, or here on the forums)
The only 'fun' part comes if you want to change the layout/format of the save information at a later date - to do that you will need to have a small function that will check if there is an old sql file and if so to load it's data up and re-save it in a new format. Set a flag variable and save that in a separate file in the docs folder too - the flag will let the code know which version of the save file it is (obviously you will need to handle this aspect as well!) There are many aspects to user data that should be thought through before releasing an App, but if you get it thought out first then you have a lot less hassle later
Cheers,
Dave
Just save the sql file in the user "documents" folder on the device. That folder should be away from the actual App and therefore not overwritten with an update.
It's actually quite easy to do. Use the "specialFolderPath" to point at the right place (look it up in the dictionary, or here on the forums)
The only 'fun' part comes if you want to change the layout/format of the save information at a later date - to do that you will need to have a small function that will check if there is an old sql file and if so to load it's data up and re-save it in a new format. Set a flag variable and save that in a separate file in the docs folder too - the flag will let the code know which version of the save file it is (obviously you will need to handle this aspect as well!) There are many aspects to user data that should be thought through before releasing an App, but if you get it thought out first then you have a lot less hassle later

Cheers,
Dave
Coding in the Sun - So much Fun.
Visit http://electronic-apps.info for released App information.
Visit http://electronic-apps.info for released App information.
-
- Posts: 7
- Joined: Tue Nov 20, 2012 9:30 pm
Re: How would you update a mobile app?
Hey Dave,
thanks for the info this is exactly what I was looking for
Cheers
thanks for the info this is exactly what I was looking for

Cheers