On a system standpoint, /data
refers to the system's data directory located at the root of the device's filesystem. However, on a user standpoints, it can be understood as the data directory located at the root of the external storage of your device (often, but not always, a SD card). For the system, this directory's path is different: /mnt/sdcard/data
for example.
As the system's /data
directory is not accessible through adb shell
, ddms
or any filesytem explorer on a non-rooted production device, I'm assuming that you are referring to the external storage's data
directory.
<external-storage>/data
, or preferably <external-storage>/Android/data
, is used to store application-related data under a directory that have the same name as your application package name (typically ext.yourbrandname.yourappname
).
But your application doesn't create such a directory automatically. Your app has to create this directory if needed. Hence the fact you don't see such a directory is not an evidence that the application is not installed.
I use the code below (usually: createRootDirectory((Activity) this)
) to create such directories. This code is designed for minSdkVersion="8" targetSdkVersion="19"
. Optimizations might exist for higher minSdkVersion
, I didn't investigate in this:
public static String storagePathToAbsolutePath(String pathFromStorageRoot) {
final StringBuffer buffer = new StringBuffer(255);
buffer.append(Environment.getExternalStorageDirectory().getAbsolutePath());
if (pathFromStorageRoot.charAt(0) != '/') {
buffer.append('/');
}
buffer.append(pathFromStorageRoot);
return buffer.toString();
}
public static boolean createRootDirectory(Context ctx) {
// Constant, copied here: private static final String BASE_DIR = "/Android/data/";
final String dataDir = storagePathToAbsolutePath(BASE_DIR + getPackageName(ctx) + "/")
final File f = new File(dataDir);
return f.mkdirs();
}
Side note: using [external-storage]/Android/data/<your application package name>
is a clean and interesting solution: if the user uninstalls the application, this corresponding data directory will automatically be deleted. This won't happen if <your application package name>
is located anywhere else, at least with old versions of Android such as 8.
/data
is a system directory used to store app-related libraries, caches, etc.

It contains a data
directory (so its path is /data/data/
). In this one, you'll actually find one directory per installed application package:

Each and every installed package has a directory named after its package name ("ext.yourbrandname.yourappname
") in the /data/data
directory, for system use. Your application, whatever it is has a directory there if it is installed.