/** * Request permission from the user to show local notifications * * @param onPermissionGrantedCallback executed when the permission is granted * @param onPermissionRefusedCallback executed when the permission is refused */ public static void RequestLocalNotificationPermission(Action onPermissionGrantedCallback, Action onPermissionRefusedCallback) { if (GameObject.Find(FGLEnhance_Callbacks.CallbackObjectName) == null) { string newName = "__FGLEnhance_Callback_" + UnityEngine.Random.Range(0, int.MaxValue); GameObject callbackObject = new GameObject(newName); callbackObject.AddComponent <FGLEnhance_Callbacks>(); } FGLEnhance_Callbacks.OnLocalNotificationPermissionGrantedCallback = onPermissionGrantedCallback; FGLEnhance_Callbacks.OnLocalNotificationPermissionRefused = onPermissionRefusedCallback; Enhance.InitializeEnhance(); #if UNITY_EDITOR FGLEditorInternals.RequestLocalNotificationsPermission(FGLEnhance_Callbacks.CallbackObjectName); #elif UNITY_ANDROID FGLAndroidInternals.RequestLocalNotificationsPermission(FGLEnhance_Callbacks.CallbackObjectName); #elif UNITY_IOS FGLiOSInternals.RequestLocalNotificationsPermission(FGLEnhance_Callbacks.CallbackObjectName); #endif }