Storing JSON on android: sqlite vs SharedPreference -


for application allow members of organisation see data on mobile device need store pre-formatted data on device can see offline well. how data trough json request-response.

the response formatted follows (anonymised ofc):

[{     "firstname":"john",     "lastname":"smith",     "group":"1",     "age":11,     "installed":"ja",     "medical":"is aan zijn linker zijde verlamd geweest.",     "notes":"heimee. \r\nbeschermend opgevoed. \r\nterug getrokken persoonlijkheid.",     "insignes":["test", "test2"],     "parents":[] }, {     "firstname":"emely",     "lastname":"watson",     "group":"33",     "age":14,     "installed":"ja",     "medical":"",     "notes":"test",     "insignes":["veilig & gezond i","cwo ii","cwo iii","kampeertechnieken & pionieren"],     "parents":[         {             "name":"ouder ouder",             "address":"op | 0000aa amsterdam",             "phone1":"",             "phone2":"0612345678",             "mail":"example@google.com"         }] }] 

i have read couple of discussion on how best store this:

is ok save json array in sharedpreferences?

how save json array in sharedpreferences?

android: best way store json data offline app in android?

android - how add json object sharedpreferences?

what advantage of using sqlite rather file?

from reading these have gathered sharedpreference files "faster" sqlite prone corruption. sqlite database , since data comes 1 inclined use @ cost of processing speed.

now need store , read data, wont mutated unless there update on "main server" in case wipe local data , repopulate it. in these threads have read storing json in sharedpreference easy difficult read.

but after reading these (and more) discussions no closer knowing/deciding best way store json is.

any advice appreciated!

you can try orms realm or sugarorm , store json has object in database. provide cipher options can encrypt data too, more flexible.

http://www.androidauthority.com/use-android-keystore-store-passwords-sensitive-information-623779/

http://www.androidhive.info/2016/05/android-working-with-realm-database-replacing-sqlite-core-data/

if don't need use orm third parties can directly encrypt json string android keystore keys , can store encrypted string in normal sqlite.


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -