Android App Updating Without Losing Data
Asked Answered
D

3

7

I'm new to Android development, so I'm trying to do an app that stores information about a warehouse. However, I'm afraid that if I perform an update, the user data will get lost. Do I have to manage which data should remain unchanged upon updating?

Also, I would like to know if it would make any difference to use a serializable class or to use an SQL database if I want to keep the data safe.

Thanks a lot :)

Disorderly answered 4/7, 2015 at 20:12 Comment(1)
You can compress the data and upload it in Cloud later sync and re-construct the data again.Ician
S
3

When you update the app, SharedPreferences and SQLite will not lose data. So you can store data there. Or you can store data in external storage or in remote server.

According to section 2 in this article, the serialize class is not safe, if you want to keep the data safe, then you can refer this post for more information. There are some tools that can cipher your database, but it is preferred to cipher your data before inserting into the database.

Soria answered 5/7, 2015 at 1:14 Comment(0)
G
2

1) No data will be lost during an upgrade, only when you uninstall the app. But be very careful if you change the data format between versions, you'll have to implement some migration code.

2) SQLite data is safe across upgrades, including Android system upgrades. However, Serializable is not. Never use Serializable to persist data reliably in the long term. Use something like JSON, XML or protocol buffers to serialize your objects.

Goethite answered 5/7, 2015 at 1:23 Comment(0)
C
1

If server space isn't an option I would suggest using SharedPreferences. So long as your package name doesn't change all of your data will persist beyond an update.

Common answered 5/7, 2015 at 1:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.