Why don't I have permission to write to app dir on external storage?

前端 未结 2 991
余生分开走
余生分开走 2021-02-04 02:53

The TL;DR question summary: My Android app tries to write to the app\'s external storage directory on an SD card. It fails with a permi

2条回答
  •  故里飘歌
    2021-02-04 03:57

    Since one app worked and another didn't, the difference was between the apps, not with the device or card. The directory in question does not require any Android permissions (e.g., WRITE_EXTERNAL_STORAGE). The only reason why you would not be able to write to it would be if the Android system had not set up the filesystem permissions properly.

    I may have created that directory myself, and failed to set up permissions somewhere?

    I am not certain that you can create that directory yourself from outside the app and have it work. Ideally that would be fine, but I have not tried it and I can see where that might pose problems.

    Is there another reason not to trust it?

    Given the filesystem shenanigans that are going on, I get very nervous when developers make assumptions regarding the nature of paths, that's all.

提交回复
热议问题