1

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.

Danish
  • 676
  • 5
  • 10
  • 1
    If by "my app internal directory", you mean that you are using methods on `Context`, such as `getFilesDir()` or `getExternalFilesDir()`, you do not need a permission. – CommonsWare Feb 25 '23 at 16:45
  • @CommonsWare Yes I am using getExternalFilesDir("") method which creates my app directory inside Android/data/(directory with)mypackagename. I will upload my app to playstore so I want to be sure if I have to ask for runtime or not because I dont want my playstore developer account to have strike or suspended app or in worst case termination. – Danish Feb 25 '23 at 17:02

1 Answers1

0

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.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Thanks alot Sir. You are right I removed read and write external storage permission from my Android manifest file and my app still works. Again Thanks alot for your quick help. – Danish Feb 25 '23 at 17:12