Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android 6.0 permissions and mounting OBB

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:

  • Motorola Nexus 6
  • LG Nexus 5

But it seems it doesn't have na access to this directory on:

  • Samsung Galaxy S5, S6 and S7
  • Nvidia Shield tablet

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:

  1. Does the game need a READ/WRITE _EXTERNAL_STORAGE in order to read and download OBB file?
  2. If yes, then how can I possibly get rid of the alert which asks the user for permissions.
  3. If no, then why Samsung Galaxy S series make such troubles?
like image 619
zompi Avatar asked Jul 13 '16 15:07

zompi


2 Answers

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 :)

like image 145
zompi Avatar answered Nov 29 '22 08:11

zompi


You are kindly invited to check if your application from store has writting permission.

like image 45
Ciprian Jijie Avatar answered Nov 29 '22 09:11

Ciprian Jijie