Skip to content

Commit

Permalink
Added Package Manager support
Browse files Browse the repository at this point in the history
  • Loading branch information
yasirkula committed Apr 28, 2020
1 parent ee0ba27 commit c19a719
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 3 deletions.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 13 additions & 3 deletions README.md → .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,19 @@

This plugin helps you query/request runtime permissions **synchronously** on Android M and later. It also works on older Android versions and detects whether a requested permission is declared in AndroidManifest or not.

## How To
## INSTALLATION

Simply import [RuntimePermissions.unitypackage](https://github.com/yasirkula/UnityAndroidRuntimePermissions/releases) to your project and you are good to go! There is one optional step, though: by default, Unity shows a permission dialog on startup to prevent plugins from crashing/malfunctioning. This can be disabled, if you want; but you must make sure to handle all the runtime permissions carefully in your app's lifecycle. To disable this dialog, add the following line inside the `<application>...</application>` tag of *Plugins/Android/AndroidManifest.xml*:
There are 4 ways to install this plugin:

- import [RuntimePermissions.unitypackage](https://github.com/yasirkula/UnityAndroidRuntimePermissions/releases) via *Assets-Import Package*
- clone/[download](https://github.com/yasirkula/UnityAndroidRuntimePermissions/archive/master.zip) this repository and move the *Plugins* folder to your Unity project's *Assets* folder
- import it from [Asset Store](https://assetstore.unity.com/packages/tools/integration/android-runtime-permissions-117803)
- *(via Package Manager)* add the following line to *Packages/manifest.json*:
- `"com.yasirkula.androidruntimepermissions": "https://github.com/yasirkula/UnityAndroidRuntimePermissions.git",`

## HOW TO

Before we start, there is one optional step: by default, Unity shows a permission dialog on startup to prevent plugins from crashing/malfunctioning. This can be disabled, if you want; but you must make sure to handle all the runtime permissions carefully in your app's lifecycle. To disable this dialog, add the following line inside the `<application>...</application>` tag of *Plugins/Android/AndroidManifest.xml*:

```xml
<meta-data android:name="unityplayer.SkipPermissionsDialog" android:value="true" />
Expand All @@ -37,7 +47,7 @@ You can use the following *static* functions of **AndroidRuntimePermissions** to

`void OpenSettings()`: opens the settings for this app, from where the user can manually grant permission(s) in case a needed permission's state is *Permission.Denied*

## Example Code
## EXAMPLE CODE

The following code requests *WRITE_EXTERNAL_STORAGE* permission (it must be declared in *AndroidManifest*) when bottom-right corner of the screen is touched:

Expand Down
File renamed without changes.
7 changes: 7 additions & 0 deletions LICENSE.txt.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Plugins.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name": "AndroidRuntimePermissions.Runtime"
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "com.yasirkula.androidruntimepermissions",
"displayName": "Android Runtime Permissions",
"version": "1.1.0",
"description": "This plugin helps you query/request runtime permissions synchronously on Android M and later. It also works on older Android versions and detects whether a requested permission is declared in AndroidManifest or not."
}
7 changes: 7 additions & 0 deletions package.json.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c19a719

Please sign in to comment.