2

Regarding the WRITE_EXTERNAL_STORAGE, the Android docs state that

Starting in API level 19, this permission is not required to read/write files in your application-specific directories returned by getExternalFilesDir(String) and getExternalCacheDir().

My app only reads and writes to the Android/data//files directory. Does that mean that, in order to read and write to this specific directory whenever my app runs on Android versions earlier than 19, I still will need to declare this permission in the manifest?

user642252
  • 513
  • 5
  • 22

1 Answers1

7

Android doc says here:

Beginning with Android 4.4, reading or writing files in your app's private directories does not require the READ_EXTERNAL_STORAGE or WRITE_EXTERNAL_STORAGE permissions. So you can declare the permission should be requested only on the lower versions of Android by adding the maxSdkVersion attribute:

<manifest ...>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
                     android:maxSdkVersion="18" />
    ...
</manifest>

So the answer is explicitly YES.

ugur
  • 3,604
  • 3
  • 26
  • 57