Comment by nolist_policy
1 day ago
Runtime permissions where introduced in 2015 with Android 6.0 (SDK 23).
So you indeed need to use a new enough Android Studio and compile against SDK 23. You need to use the new API, I think the easiest way is to add a button and call requestPermissions() [1], you can leave the rest of the code unmodified.
Also, note that Google Play does not allow the external storage access permission except if it's a file manager app. It's better to use the SAF API (since Android 4.4 SDK 19) instead. Depending on your app, that may need bigger changes.
By the way, I'm working on a syscall interception framework[2] that could in theory intercept the file io syscalls and redirect them to use the SAF API. That would need only minimal changes to your app and also would allow to run things like syncthing unmodified.
You need to make these changes anyway, because Android 14+ can not install apps with targetSdkVersion < 23.
[1] https://developer.android.com/training/permissions/requestin...
Thanks, very useful! I don't think I need anything as drastic as intercept-anything, but that is a cool project.
2015, wow, I didn't realise how out of date I am.
And yes, I realise that I probably shouldn't require external storage access anyway, although that allows me to do custom previewing. I could use an external file picker. Well, I have some work to do but it's much less daunting now!