Reputation: 43
I am developing Android application, which have json file in Assets folder. Now I want to update this file later from server, but it seems it is not possible to update files inside Assets folder at run time. So my question is which is the best location where I should put this json file initially and later it can be also updated from server. I also don't want to update android code and ask user to update application from the market.
Upvotes: 4
Views: 1480
Reputation: 691
/data/data/your.package.name/ (this is local folder to your application) or sqlite. Next time there is a change your file can be directly downloaded to /data/data/your.package.name/ or sqlite DB.
Upvotes: 1
Reputation: 7450
It's really hard to add or modify files inside a apk, and apps should not do this.
You have a config file in assets folder, it's the inital config. When you download a new version config file, you can put it in sdcard, save it in SharedPreference or any other methods for persistence. When you want to use it, you can just loop through all these configs and find a newest one.
Upvotes: 0
Reputation: 4467
You can save the json to shared preference or sqlite, and then invoke server api to update local data.
Upvotes: 1