Where to store application data on Android?

Dmitriy R picture Dmitriy R · Jul 17, 2011 · Viewed 14k times · Source

I use to use user.home + app_name directory under Linux and Windows. However directory given me by Android for user.home has no right to write. So what is common practice of storing application data? My situation even more complicated. The data I need to store belong not to Android application, they belong to web application deployed on Android device, so suggestion using standard Android way may not work for me.

Answer

darlinton picture darlinton · Jul 17, 2011

Well, there are many ways to store data in Adroid: http://developer.android.com/guide/topics/data/data-storage.html

If you are running a web application in a Android then you need to use data storage of web apps: http://diveintohtml5.ep.io/storage.html .

If you still want to keep the idea of filesystem access through web app, maybe this tutorial may help you: http://www.vogella.de/articles/AndroidFileSystem/article.html - mind the permissions.

Although, if you need to store data in the Android system you should choose to build an android app instead of use the web app to control the local data storage. You can get data from your web app using a URL Connection (http://developer.android.com/reference/java/net/URLConnection.html) and manage the storage through the Android app.