Write application data on private directory on sdcard android 4.4 and above

前端 未结 2 1665
南笙
南笙 2021-01-25 20:38

There are many questions about this topic, but I cannot find any answers for my corrective example.

I\'m using Samsung galaxy S5 run android 4.4, which is limited for st

相关标签:
2条回答
  • 2021-01-25 21:21

    Your app specific directory should be /storage/extSdCard/Android/data/com.myapp.example/files and not /storage/extSdCard/Android/com.myapp.example/files

    0 讨论(0)
  • 2021-01-25 21:22

    If getExternalFilesDir(null) is returning somewhere different to /storage/extSdCard/Android/com.myapp.example/files, then I would think that is why it is giving you access permission errors. The only place on the SD card you can write to without permissions is the directory returned by getExternalFilesDir()

    Since you say the directory returned by getExternalFilesDir(null) is not acceptable, I would suggest adding the WRITE_EXTERNAL_STORAGE permission to your manifest.

    0 讨论(0)
提交回复
热议问题