/** * Check if external storage is built-in or removable. * * @return True if external storage is removable (like an SD card), false otherwise. */ @TargetApi(9) public static boolean isExternalStorageRemovable() { if (Android.isAPI(9)) { return Environment.isExternalStorageRemovable(); } return true; }
/** * Get the external app cache directory. * * @param context The context to use * @return The external cache dir */ @TargetApi(8) public static File getExternalCacheDir(Context context) { // Do we have a built-in external cache dir method. if (Android.isAPI(8)) { File cacheDir = context.getExternalCacheDir(); if (cacheDir != null) { return cacheDir; } } // Before Froyo we need to construct the external cache dir ourselves final String cacheDir = "/Android/data/" + context.getPackageName() + "/cache/"; return new File(Environment.getExternalStorageDirectory().getPath() + cacheDir); }