Skip to content

Latest commit

 

History

History
58 lines (51 loc) · 1.15 KB

README.md

File metadata and controls

58 lines (51 loc) · 1.15 KB

PermissionPlugin

A set of tools for Unity to allow handling Permission for Android and iOS.

Install

PermissionPlugin.unitypackage

Usage

using Permission;

Example: Check permissions.

public IEnumerator Example()
{
  yield return PermissionPlugin.Check(PermissionType.Camera, result =
  {
    Debug.Log(result);
  });
}

Example: Request permission.

public IEnumerator Example()
{
  yield return PermissionPlugin.Request(PermissionType.Camera, result =>
  {
    Debug.Log(result);
  });
}

Example: Open permission setting screen.

public void Example()
{
  PermissionPlugin.Open(PermissionType.Camera);
}

AndroidManifest.xml

Replace main Activity.

<!--
<activity android:name="com.unity3d.player.UnityPlayerActivity" ...
-->
<activity android:name="com.hiyorin.permission.CustomUnityPlayerActivity" ...

When using your own UnityPlayerActivity

Please pass the value of OnRequestPermissionsResult of your Activity

public void Exapmle(int requestCode, string[] permissions, int[] grantResults)
{
  PermissionPlugin.AndroidRequestPermissionsResult(requestCode, permissions, grantResults);
}