• Stars
    star
    136
  • Rank 267,670 (Top 6 %)
  • Language
    C#
  • License
    MIT License
  • Created about 9 years ago
  • Updated almost 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Android Runtime Permission for Unity

UniAndroidPermission

Plugin for use runtime permission at unity. It works only Android Devices runtimepermission

Requirement

Unity5 or higher

Installation

Use unitypackage at the release page

Usage

1 Add uses-permission to AndroidManifest

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 

2 Add Custom Activity and SkipPermissionsDialog to Android Manifest

<activity android:name=“net.sanukin.OverrideUnityActivity"
         android:label="@string/app_name"
         android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>
<meta-data android:name="unityplayer.SkipPermissionsDialog" android:value="true" />

3 Add UniAndroidPermission.prefab at boot scene ※ Don't rename object name!!

4 Call method before function which need permissions

Check if permission permitted.

UniAndroidPermission.IsPermitted (AndroidPermission.WRITE_EXTERNAL_STORAGE)

Request Permission

public void RequestPermission()
{
    UniAndroidPermission.RequestPermission(AndroidPermission.WRITE_EXTERNAL_STORAGE, OnAllow, OnDeny, OnDenyAndNeverAskAgain);
}

private void OnAllow()
{
    // execute action that uses permitted function.
}

private void OnDeny()
{
    // back screen / show warnking window
}

private void OnDenyAndNeverAskAgain()
{
    // show warning window and open app permission setting page
}

Author

sanukin39

License

The MIT License

More Repositories

1

UniClipboard

Simple clipboard plugin for unity
C#
308
star
2

UniColliderInterpolator

Unity plugin of interpolate non-convex collider to convex.
C#
139
star
3

UniMeshCombiner

Simple Unity Mesh Combine Tool
C#
114
star
4

UniLocalNotification

Simple Local Notification Plugins for Unity
Java
71
star
5

UniVertexColorModelGenerator

Simple Unity Generate Vertex Color Model Tool
C#
38
star
6

UniEditorScreenshot

Simple editor extension for taking screenshot at Unity editor
C#
25
star
7

UniVersionManager

C#
15
star
8

UniSafeArea

Simple safe area support tool for Unity
C#
11
star
9

UnityScrollLineSample

Unity drawing scroll line sample
C#
11
star
10

UniIosAudioService

Unity iOS plugin JUST playing iOS system sound
C#
9
star
11

LocalNotificationIOS

IOS local notification sample of unity
C#
8
star
12

UniMeshTransformer

Simple mesh transform tool for Unity
C#
7
star
13

UniAndroidVibration

Unity Android plugin JUST execute device vibration
Java
7
star
14

UniPlaneMeshGenerator

Plane mesh generator for Unity
C#
7
star
15

UniRequestReview

Request Default iOS Review Dialog Plugin for Unity
C#
5
star
16

SimpleThreeMatchPuzzle

Simple three match puzzle made by unity
C#
4
star
17

SceneManagerTest

UnityのSceneManagerを使ってソシャゲっぽい遷移をするサンプル
C#
4
star
18

ShaderGraphFlutteringFlagSample

Fluttering flag shader sample of Unity URP
4
star
19

unity-player-prefs-editor

C#
4
star
20

UniNavigationSample

Unity Navigation Sample
C#
4
star
21

UniStoreOpener

UnityのiOS, Androidアプリからそれぞれのアプリページを開く
C#
4
star
22

UnityRequestReview

ShaderLab
3
star
23

UnityBatchBuildSample

Sample project of unity batch build
C#
2
star
24

UniDeviceInfo

C#
2
star
25

UniStorage

C#
2
star
26

IconBadgeCleaner

C#
1
star
27

UniColorPicker

Simple, light weight color picking module for Unity
C#
1
star
28

MiniP

Simplest png compression tool
JavaScript
1
star