I having problem about using persistentDataPath on Android.
I know that persistentDataPath will return different data path base on “write access” setting.
same of permission __WRITE_______EXTERNAL_______STORAGE in AndroidManifest.xml
Internal Only : data/data/xxxx/files/ ( Player cannot get file inside this path without root )
External ( SD Card ) : Android/data/com.xxx.xx/files/ ( Player can get file inside this path without root )
However, I am going to save game data into Internal persistentDataPath, but i have WRITE_ EXTERNAL_STORAGE permission because i want to use expansion file( .obb ), but now my game data saved at SD Card and player can get file and edit.
So my question is, how can i save data into internal persistentDataPath with __WRITE_______EXTERNAL_______STORAGE permission ?
=== UPDATE ===
I am trying to hard code internal persistentDataPath and move file from public persistentDataPath, it was success, i can move it and also read and delete _AT THE FIRST TIME, but when i quit app and launch again, i got a _UnauthorizedAccessException and blocked at Delete File action.
You can get your Android apps internal path directly from Unity without a plugin, even with permission WRITE_EXTERNAL_STORAGE. Similar code can be used to get any other path.
I spent 2 days on this :P. First I made my own Java plugin, but as I do not like to extend my current Activity or Application I ran into problems. Finally I pieced together how to do it directly from Unity with the following code:
Can you save your data in PlayerPrefs Unity - Scripting API: PlayerPrefs ? It cannot be modified by the user without root access. For storing several string or number values that would be pretty convenient.
Otherwise, I can’t remember a simple way of having WRITE_EXTERNAL_STORAGE and having your data path in the internal storage.
You need to write a native android plugin to return the internal storage path, and not use the Application.persistantDataPath. Look at the code in this example: 日本入室强伦姧BD在线观看,日韩中文人妻无码不卡,卧室征服朋友人妻,人妻办公室被强奷