Is there a way to enable external storage without losing the local save data that is usually kept /data/data/com…
After enabling
WRITE_EXTERNAL_STORAGE
It redirects all data to /mnt/sdcard/Android/data/data/com…
My problem is this new feature will give users the ability to take screenshots in the game and save them on the sd card, but by enabling WRITE_EXTERNAL_STORAGE to allow me to save to the SD card it changes the data path and will force the user to restart their game.
Ok I just figured it out: I have to stop using Application.persistentDataPath and point it directly to the path.
I was going to move it to the SD also, but I’m better off leaving it there for protection from the phones that don’t have root access.
I’m thinking of moving the existing data over to the sd card because I’m scared that there will be an android update later or some type of cleanup tool that will wipe the users data because my new update will be using the sd card.
The downside to that is I’m now scared that the user will have access to the XML files with there save game. The important data in the file in encrypted, but they can try to crack it once its there and change some of the other values I don’t protect like the cash in game which would be easy regardless of the encryption because XXXX will always be more than 0.
What do you guys think? I think the safe bet would be to move the data to keep users happy, but I would be taking a risk somebody will go in there and alter their games.
I spoke too soon. I still have read access to the /data/data/com…directory and when I uninstall and reinstall it does erase it the internal directory and recreate it, but I don’t have write access to that directory.
Any ideas? Hopefully it’s just something I have to add to the manifest to enable write access.
Here is the exact error:
UnauthorizedAccessException: Access to the path “/data/data/XXXX/files/Items.xml”
So if I have WRITE_EXTERNAL_STORAGE enabled I get the error above and if I have WRITE_EXTERNAL_STORAGE disabled I can write to “/data/data/XXXX/files/Items.xml”, but I then lose access to the SD card.
Could it be related to:
http://mono-for-android.1047100.n5.nabble.com/UnauthorizedAccessException-after-upgrading-to-ver-4-0-td5065129.html
Yeah it seems like that was the problem. I was on 3.4 and updated to 3.4.2 which seems to have resolved the problem.