androidandroid-studioandroid-permissionsandroid-storageandroid-runtime

Is asking for runtime permission necessary in android if I am writing to my apps internal directory?


Is it necessary to ask for runtime permission for my app that has read and write external storage permission declared in manifest.xml file? Note,I am only reading and writing to my app internal directory(com.mypackagename). I am not reading or writing any file to any other storage directory.


Solution

  • Yes I am using getExternalFilesDir("") method

    Then you do not need to request permissions at runtime for access. You also do not need READ_EXTERNAL_STORAGE or WRITE_EXTERNAL_STORAGE in the manifest.

    I want to be sure if I have to ask for runtime

    If your app runs, you do not need to ask for the runtime permission. The symptom of missing a runtime permission request is that you crash due to security exceptions, not that Google (or anyone else) will do something to your store listing.