A set of tools for Unity to allow handling Permission for Android and iOS.
PermissionPlugin.unitypackage
using Permission;
public IEnumerator Example()
{
yield return PermissionPlugin.Check(PermissionType.Camera, result =
{
Debug.Log(result);
});
}
public IEnumerator Example()
{
yield return PermissionPlugin.Request(PermissionType.Camera, result =>
{
Debug.Log(result);
});
}
public void Example()
{
PermissionPlugin.Open(PermissionType.Camera);
}
Replace main Activity.
<!--
<activity android:name="com.unity3d.player.UnityPlayerActivity" ...
-->
<activity android:name="com.hiyorin.permission.CustomUnityPlayerActivity" ...
Please pass the value of OnRequestPermissionsResult of your Activity
public void Exapmle(int requestCode, string[] permissions, int[] grantResults)
{
PermissionPlugin.AndroidRequestPermissionsResult(requestCode, permissions, grantResults);
}