Skip to content

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

License

Notifications You must be signed in to change notification settings

hiyorin/PermissionPlugin-for-Unity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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);
}

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published