Hi,
For a SDK I use I need to ask permission to the user in runtime on android. So I use the Permission.RequestUserPermission class. This should popup an android dialog asking for permission.
However,
When I build without the development build check, so a regular build this works. But when I make a development build, this doesn’t work. So I went on to research the problem, and found out Unity adds the following 2 lines in the final manifest, I can find in the temp folder.
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="18" />
And i’m using SDK version 19. These 2 lines don’t get added when building without development build checked. Why is this? And how can I fix this? I want to be able to make development builds of course.
I have not made a custom manifest file, so it’s the standard Unity manifest that’s being made.
Below is how I ask permission to the user:
#if UNITY_ANDROID && !UNITY_EDITOR
if (!Permission.HasUserAuthorizedPermission(Permission.ExternalStorageWrite))
{
Debug.Log(":: Requesting permission.");
Permission.RequestUserPermission(Permission.ExternalStorageWrite);
}
else
{
Debug.Log(":: Application already gave permission.");
}
#else
Debug.Log(":: Platform is not android, not asking permission.");
#endif
}