diff --git a/Images/permission.png b/.github/Images/permission.png similarity index 100% rename from Images/permission.png rename to .github/Images/permission.png diff --git a/JAR Source/RuntimePermissions.java b/.github/JAR Source/RuntimePermissions.java similarity index 100% rename from JAR Source/RuntimePermissions.java rename to .github/JAR Source/RuntimePermissions.java diff --git a/JAR Source/RuntimePermissionsFragment.java b/.github/JAR Source/RuntimePermissionsFragment.java similarity index 100% rename from JAR Source/RuntimePermissionsFragment.java rename to .github/JAR Source/RuntimePermissionsFragment.java diff --git a/JAR Source/RuntimePermissionsReceiver.java b/.github/JAR Source/RuntimePermissionsReceiver.java similarity index 100% rename from JAR Source/RuntimePermissionsReceiver.java rename to .github/JAR Source/RuntimePermissionsReceiver.java diff --git a/README.md b/.github/README.md similarity index 77% rename from README.md rename to .github/README.md index ca9e349..a4fcb2d 100644 --- a/README.md +++ b/.github/README.md @@ -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 `...` 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 `...` tag of *Plugins/Android/AndroidManifest.xml*: ```xml @@ -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: diff --git a/LICENSE b/LICENSE.txt similarity index 100% rename from LICENSE rename to LICENSE.txt diff --git a/LICENSE.txt.meta b/LICENSE.txt.meta new file mode 100644 index 0000000..0e2ab12 --- /dev/null +++ b/LICENSE.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 3164c62e3fcedf14bbed0d4fe67a7ed6 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Plugins.meta b/Plugins.meta new file mode 100644 index 0000000..1cde9ca --- /dev/null +++ b/Plugins.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4cee5170601157240b10df1cd0f607dd +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Plugins/AndroidRuntimePermissions/AndroidRuntimePermissions.Runtime.asmdef b/Plugins/AndroidRuntimePermissions/AndroidRuntimePermissions.Runtime.asmdef new file mode 100644 index 0000000..378b6e4 --- /dev/null +++ b/Plugins/AndroidRuntimePermissions/AndroidRuntimePermissions.Runtime.asmdef @@ -0,0 +1,3 @@ +{ + "name": "AndroidRuntimePermissions.Runtime" +} diff --git a/Plugins/AndroidRuntimePermissions/AndroidRuntimePermissions.Runtime.asmdef.meta b/Plugins/AndroidRuntimePermissions/AndroidRuntimePermissions.Runtime.asmdef.meta new file mode 100644 index 0000000..277ce52 --- /dev/null +++ b/Plugins/AndroidRuntimePermissions/AndroidRuntimePermissions.Runtime.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 3caf90d9f0ecf444e865b5fbaa0930af +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/package.json b/package.json new file mode 100644 index 0000000..8feb981 --- /dev/null +++ b/package.json @@ -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." +} \ No newline at end of file diff --git a/package.json.meta b/package.json.meta new file mode 100644 index 0000000..74149f0 --- /dev/null +++ b/package.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 6c93c93f557980c45a8d42ea83dd9b9b +PackageManifestImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: