pacien / tincapp

Android binding and user interface for the tinc mesh VPN daemon.
https://tincapp.euxane.net
GNU General Public License v3.0
165 stars 31 forks source link

"Storage access: permission denied" on Android-x86 #79

Closed ghost closed 5 years ago

ghost commented 5 years ago

When I try to generate node configuration and keys, I got this error:

Could not create directory /storage/emulated/0/Android/data/org.pacien.tincapp/files/2n8asm: Permission denied

When I run adb shell pm grant org.pacien.tincapp android.permission.WRITE_EXTERNAL_STORAGE, I got this error:

Operation not allowed: java.lang.SecurityException: Package org.pacien.tincapp has not requested permission android.permission.WRITE_EXTERNAL_STORAGE

I think it is necessary to add <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> to AndroidManifest.xml(See this.)

pacien commented 5 years ago

Hello,

This permission isn't necessary for the app to write on its dedicated directory on either the internal or external storage.

Beginning with Android 4.4 (API level 19), reading or writing files in your app's private external storage directory—accessed using getExternalFilesDir()—does not require the READ_EXTERNAL_STORAGE or WRITE_EXTERNAL_STORAGE permissions. – the documentation

Note that some Android distributions such as Android-x86 do not implement filesystem permissions correctly on the external storage. This is a bug that should be reported to them and fixed on their side.

A possible workaround that we could implement would be to request this permission conditionally at run-time. A pull request for this would be welcomed.

pacien commented 5 years ago

FAQ entry added:

Permission denied on external storage Some Android distributions such as Android-x86 do not implement file access permissions correctly. On those ROMs, it is necessary to manually grant the Storage permission to the application in the System settings.

rwky commented 5 years ago

For anyone else finding this, I had to do it on my Samsung Galaxy S10.