Android 6 (Marshmallow) Runtime Permissions Issues

I have couple of questions related to Android 6 Runtime Permissions feature:

  1. Unity 4.7 asks all dangerous permissions (eg. WRITE_EXTERNAL_STORAGE) on start during black screen, when this issue will be resolved?
  2. Is there going to be a runtime permission management system where we can query current allowed/denied permissions and manage permissions?
  3. I have encountered a meta-data tag on this forum thread. I need an explanation on this tag (written below) because I am planning to use it on production environment, can I rely on it?

Thank you in advance

I think that Android itself exposes APIs to query for permissions. Maybe this is something you can already (easily) develop for yourself.

Hi liortal,

I am aware of what Android exposes. However, in Unity 4.7 if I use API level 23 all dangerous permissions are asked to the user on start during black screen. Am I able to override what Unity does here?

They deliberately ask this so your game won’t crash when the code asks to do something that requires these permissions…

I know that but I would like to handle permissions during runtime not on start. Handling all permissions on start is not a good solution at all. Since Unity 4 is not supported anymore, we are stuck with what we have at hand.

The issue is not Unity, but with Android 6 that requires these permissions.

What would have been the best solution, in your opinion ?

What that tag does is, Unity does not ask for permissions at all and you should ask the permissions yourself (by writing some sort of plugin) at your own risk.

WRITE_EXTERNAL_STORAGE should be asked at the start anyway, since OBB files need it.

1 Like

I wrote a really good plugin for this
http://stackoverflow.com/questions/35027043/implementing-android-6-0-permissions-in-unity3d/

An “almost official” plugin for the permission management: GitHub - Over17/UnityAndroidPermissions: Unity Android Runtime Permissions for Android Marshmallow

2 Likes

@Yury-Habets : I see below needs to be added to skip the permission dialogs at startup.

<meta-data android:name="unityplayer.SkipPermissionsDialog" android:value="true" />

I suppose unity does this by fetching all the permissions required from manifest and run requestPermissions of Unity activity internally (Please correct me if i’m wrong).

Even though Unity does this on purpose to make sure all apps will have quick access to >= API 23, we as plugin publishers find it a bit difficult to handle this case. In most of the cases we try to avoid touching the root Manifest as the devs who uses our plugin will have smooth integration.

We request you to make this flag as a setting while exporting the Android build instead of making it mandatory to add it in the root manifest file.

If you have any suggestions, we request you to please help us.

Thanks,
VB Team

Fair enough! Thanks for the feedback.
On our side, we would be grateful if the plugin developers would implement the runtime permission system.

1 Like

Thanks for considering the suggestion.
This helps many plugin devs like us to make sure we don’t touch the Root manifest to keep learning curve for the developers minimal :slight_smile:

Cheers,
VB Team

Hi,

I found out that android 6 and 7 have this problem on unity 4, i have an app on play store that relies on unique identifier of unity.

Can you or someone please send me a link to the compiled jar?
And what should i do with the sh code? how i can create this sh file and where to put it?
When i put the C# code inside the hierarchy folder shown in the topic unity stops recognizing it

And by the way
I’m using unity 4 latest version, someone knows if this problem is absolutely solved in the latest unity 5? I use 4 because when i upgrade my project the more complex assets/prefabs like cars of the game get their wheel collider physics “bugged” with lots of strange behaviour that i can’t fix even replacing the colliders.

Your choices are to create the Jar using the post I told you about or buy the Prime31 Etcetera plugin which also supports this feature.

We are already with runtime permissions now and we don’t need any changes from unity on this context :slight_smile: