Android API >29 and External Storage Access

I work on a medical training simulator that bundles a lot of PDF based documentation. The idea is to make this documentation persistent to the user outside of the trainer. The Play Store now requires APKs to target API-29 or greater and the permission changes starting in API-29 are giving my team a little trouble.

My Question is.

What is the proper way to write to the external sdcard in Android?

My current approach is to embed the file contents as c_strings in a native library and write them to disk on request. Iā€™m not sure if its possible to just bundle the files directly in to the APK in unreal and have them extract on installation.

I am currently adding to the project settings the following permissions

android.permission.WRITE_EXTERNAL_STORAGE
android.permission.READ_EXTERNAL_STORAGE
android.permission.MANAGE_EXTERNAL_STORAGE /*API 30*/

I think verify these permissions at runtime and request them if they are missing. Permission Manager shows WRITE/READ are granted but on Manage is denied.

The HAL implementation of File Write fails and I tried hand rolling ostream implementations and they execute but result in no file IO.

I find myself rereading the scoped permissions page in the android developer documentation, but have been out of mobile development to long to really understand what I need to do. Does anyone have insight on the right way to just create Hello_World.txt on the sdcard in android?

2 Likes