I have a problem with permissions on Android 6.0 and higher.
The game I'm working on was using the WRITE_EXTERNAL_STORAGE permission. On Android 6.0 and higher the alert which asks a user to allow it had to be displayed.
I've received a request to get rid of this alert, which means, the game cannot use WRITE_EXTERNAL_STORAGE anymore.
Technically the game is not writing and reading the external storage anywhere right now. All saves and cached files are stored in the application-specific directory (/storage/emulated/0/Android/data/com.company.productname) But, the game has to read (and sometimes download) the OBB file, which is stored in /storage/emulated/0/Android/obb/com.company.productname directory.
The game has an access to this directory, even without WRITE_EXTERNAL_STORAGE or READ_EXTERNAL_STORAGE on devices:
But it seems it doesn't have na access to this directory on:
I've checked it even using the Alpha Tests in order to simulate downloading the game from the store.
When the permission to the Storage is given (via App Settings) then everything runs fine.
How the OBB is mounted?
The Unreal Engine 4, which I use, is using the C open() function to handle the OBB file:
int32 Handle = open(LocalPath, O_RDONLY);
Where LocalPath is a full path to the obb file: /storage/emulated/0/Android/obb/com.company.productname/main.10003.com.company.productname.obb
The questions are:
Ok, it seems the issue was listed somewhere else, but I couldn't find because I didn't know it was the exact issue...
https://code.google.com/p/android/issues/detail?id=197287
The API23 for some reason set's the user of the OBB to root, not the proper user and because of it the app has no access to it.
After rebooting the device everything works fine.
At this point there is no clear workaround for this.
Thanks @Larry for providing all necessary and helpful information :)