I got an exception in our crashReport system.
UnauthorizedAccessException
Access to the path "/storage/emulated/0/Android/data/com.tencent.xgame/files/systemData" is denied.
1 ES2FileUtility.CreateFileStream (System.String path, ES2FileMode filemode, Int32 bufferSize)
2 ES2FileStream.CreateStorageStream ()
3 ES2FileStream.Store ()
4 ES2.Save [T] (.T param, System.String identifier)
5 SelectGameViewWnd.OnClickBtnOK ()
6 UnityEngine.Events.InvokableCallList.Invoke (System.Object[] parameters)
7 UnityEngine.EventSystems.ExecuteEvents.Execute [T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.EventFunction`1 functor)
8 MyTouchInputModule.ProcessTouchPress (UnityEngine.EventSystems.PointerEventData pointerEvent, Boolean pressed, Boolean released)
9 MyTouchInputModule.ProcessTouchEvents ()
10 MyTouchInputModule.Process ()
Code: Select all
ES2.Save<SystemData>(SettingData.Instance.SystemData,"systemData");
It seems player has denied the permission. How to check if we have the permisson in unity?If the device is running Android 6.0 (API level 23) or higher, and the app's targetSdkVersion is 23 or higher, the app requests permissions from the user at run-time. The user can revoke the permissions at any time, so the app needs to check whether it has the permissions every time it accesses permission-protected APIs. For more information about requesting permissions in your app, see the Working with System Permissions training guide.
If the device is running Android 5.1.1 (API level 22) or lower, or the app's targetSdkVersion is 22 or lower, the system asks the user to grant the permissions when the user installs the app. If you add a new permission to an updated version of the app, the system asks the user to grant that permission when the user updates the app. Once the user installs the app, the only way they can revoke the permission is by uninstalling the app.