Is it possible to get the info from Settings -> Storage in android and use it in my app? What I have so far is total space and available space, but I want to get also the space taken by apps, photos, downloads, etc. :
public class MainActivity extends Activity {
private final String TAG = "abc";
private final double BYTES_TO_GB_FACTOR = Math.pow(2, 30);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
StatFs stat = new StatFs(Environment.getDataDirectory().getPath());
long bytesAvailable = stat.getAvailableBytes();
long bytesTotal = stat.getTotalBytes();
Log.d(TAG, "GB available: " + bytesAvailable / BYTES_TO_GB_FACTOR);
Log.d(TAG, "GB total: " + bytesTotal / BYTES_TO_GB_FACTOR);
}
}