Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to store application data on Android?

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.

like image 721
Dmitriy R Avatar asked Jul 17 '11 01:07

Dmitriy R


2 Answers

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.

like image 143
darlinton Avatar answered Sep 21 '22 20:09

darlinton


You can store application data in three ways:

  1. SharedPreferences
  2. SQLite Database
  3. file

All these files are stored under the /data/data/packagename/ directory.

like image 31
Imdad Sarkar Avatar answered Sep 21 '22 20:09

Imdad Sarkar