This commit is contained in:
runette committed 2024-04-22 15:52:51 +01:00
commit e0afef912e
1285 files changed
+83219

No files matched your search

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 4aa6de0d65164fe48a9b01246c856fc8
folderAsset: yes
timeCreated: 1521070590
licenseType: Pro
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,24 @@
<!--
Android Manifest for UniAndroid Permission (2016/03/19 sanukin39)
--- if already have AndroidManifest file at Assets/Plugins/Android/ ----
Copy the activity and meta-data sentence to your AndroidManifest.xml
--- if not ---
Rename this file to AndroidManifest.xml and add permission you want to add And move the file to Assets/Plugins/Android
-->
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.company.product">
<application android:icon="@drawable/app_icon" android:label="@string/app_name">
<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" />
</application>
</manifest>
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9a957c06543b147a1b950f050282d728
timeCreated: 1458403910
licenseType: Free
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,111 @@
using System;
using UnityEngine;
public class UniAndroidPermission : MonoBehaviour
{
const string PackageName = "net.sanukin.PermissionManager";
static Action onAllowCallback;
static Action onDenyCallback;
static Action onDenyAndNeverAskAgainCallback;
void Awake()
{
DontDestroyOnLoad(gameObject);
}
public static bool IsPermitted(AndroidPermission permission)
{
#if !UNITY_EDITOR && UNITY_ANDROID
using (var permissionManager = new AndroidJavaClass(PackageName))
{
return permissionManager.CallStatic<bool>("hasPermission", GetPermittionStr(permission));
}
#else
return true;
#endif
}
public static void RequestPermission(AndroidPermission permission, Action onAllow = null, Action onDeny = null, Action onDenyAndNeverAskAgain = null)
{
#if !UNITY_EDITOR && UNITY_ANDROID
using (var permissionManager = new AndroidJavaClass(PackageName))
{
permissionManager.CallStatic("requestPermission", GetPermittionStr(permission));
onAllowCallback = onAllow;
onDenyCallback = onDeny;
onDenyAndNeverAskAgainCallback = onDenyAndNeverAskAgain;
}
#else
Debug.LogWarning("UniAndroidPermission works only Androud Devices.");
#endif
}
private static string GetPermittionStr(AndroidPermission permittion)
{
return "android.permission." + permittion.ToString();
}
private void OnAllow()
{
if (onAllowCallback != null)
{
onAllowCallback();
}
ResetAllCallBacks();
}
private void OnDeny()
{
if (onDenyCallback != null)
{
onDenyCallback();
}
ResetAllCallBacks();
}
private void OnDenyAndNeverAskAgain()
{
if (onDenyAndNeverAskAgainCallback != null)
{
onDenyAndNeverAskAgainCallback();
}
ResetAllCallBacks();
}
private void ResetAllCallBacks(){
onAllowCallback = null;
onDenyCallback = null;
onDenyAndNeverAskAgainCallback = null;
}
}
// Protection level: dangerous permissions 2015/11/25
// http://developer.android.com/intl/ja/reference/android/Manifest.permission.html
public enum AndroidPermission
{
ACCESS_COARSE_LOCATION,
ACCESS_FINE_LOCATION,
ADD_VOICEMAIL,
BODY_SENSORS,
CALL_PHONE,
CAMERA,
GET_ACCOUNTS,
PROCESS_OUTGOING_CALLS,
READ_CALENDAR,
READ_CALL_LOG,
READ_CONTACTS,
READ_EXTERNAL_STORAGE,
READ_PHONE_STATE,
READ_SMS,
RECEIVE_MMS,
RECEIVE_SMS,
RECEIVE_WAP_PUSH,
RECORD_AUDIO,
SEND_SMS,
USE_SIP,
WRITE_CALENDAR,
WRITE_CALL_LOG,
WRITE_CONTACTS,
WRITE_EXTERNAL_STORAGE
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 7df6f555c4d344871bf935752b861a45
timeCreated: 1448444718
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,53 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &134968
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 408032}
- component: {fileID: 11480548}
m_Layer: 0
m_Name: UniAndroidPermission
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &408032
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 134968}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &11480548
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 134968}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7df6f555c4d344871bf935752b861a45, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 134968}
m_IsPrefabParent: 1
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a83b9ab9f1dc0439fa3caaf9912be67d
timeCreated: 1448447048
licenseType: Pro
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,31 @@
fileFormatVersion: 2
guid: d6467263296c74b919030e7bfae469ca
timeCreated: 1516304615
licenseType: Pro
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
- first:
Android: Android
second:
enabled: 1
settings: {}
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.
@@ -0,0 +1,32 @@
fileFormatVersion: 2
guid: ca612e075d0834fd7bc292f91065077c
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings: {}
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,32 @@
fileFormatVersion: 2
guid: 47b0d1b4b61fc49f390843172d421aef
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings: {}
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant: