Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
4
Question by krisventure · Apr 15, 2017 at 07:35 PM · androidpersistentdatapathuninstallexternal files

Saved Android app files get automatically recovered from nowhere even after re-installing app.

I only have this issue when I set external storage (which I need for my app as it saved images to gallery). Certain files saved by my game a few months ago will keep coming back even after uninstalling the app and reinstalling it. Upon uninstall you can see that they all get deleted fine in the Android/data/... folder, along with all the app data. But then upon re-install they pop back out of nowhere, as if there was some mechanism that would recover deleted app data from some cache folder that is stored elsewhere, some automatic default mechanism that I don't know of. The recovered app files include specific images, screenshots from the game saved months ago so no way does my code add them back, it has to be sitting somewhere outside of the persistentdata path, a place that Android uses to recover data from on reinstall. It could also be a Unity recovery mechanism.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by krisventure · Apr 15, 2017 at 09:11 PM

Found the cause of the problem (took me a whole day though):
It's due to an auto-backup feature since Android 6.0. All your app data is automatically backed up to your linked Google account. You can find the back up in your Google Drive. By default the backed up data will be restored upon reinstall. I turned off Wifi on my dev phone for a while and only turned it back on recently, that's why I had this weird experience of files haunting me from the past all of a sudden.

Solution:

  1. If it bothers you too during development (as the saved data structure may change across builds), you can just turn it off in Cloud And Accounts / Backup And Restore / Automatic Restore.

  2. You can also disable auto backup for your app entirely by adding android:allowBackup=“false” to your androidmanifest.xml file inside the application statement. Make sure to add this to the manifest file at Asset/Android/Plugins, this is how you tell Unity to merge your modifications with its auto-built manifest. In case you don't have it there yet, copy the one from Temp/StagingArea after a build.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image amoswazana · May 21, 2017 at 12:28 PM 0
Share

First of all thank you so much for this. Saved me another day of work trying to figure it out. Secondly, you didn't write what should be added to the manifest... And lastly: in my Android device the location of that specific setting is in Settings -> Backup and Reset -> Automatic restore.

Thanks again :)

avatar image krisventure amoswazana · May 21, 2017 at 02:44 PM 0
Share

Thanks, I've edited! I thought I've gone crazy because I was sure I've added that info. Turns out anything you type between angle brackets will get deleted upon saving your Answer on this forum. I just copied the statement from my manifest file that was in between angle brackets so it got deleted. When I need to start debugging Q&A sites to share the results of another debugging, I'm beginning to feel dizzy :)

By the way, I decided to keep the backup function, only disabled it on my dev phone. $$anonymous$$y thinking is that this is an awesome feature after all which allows your users to continue your game/app with their earlier progress/settings even if they uninstall it and reinstall a few months later. You don't need to create personal accounts for everyone and save all that data on a server just for this yet you have the feature of restoring from earlier installs. I think that's cool

avatar image
2

Answer by JbStudio425 · Jul 04, 2019 at 04:36 AM

Include This At

Assets/Plugin/Android

 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
  
   <application android:allowBackup="false"  tools:replace="android:allowBackup">
   </application>
 
 </manifest>

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by cyborgjinx · Nov 08, 2019 at 10:05 AM

I tried this but data is still getting recovered.

I tried changing device resolution at runtime for performance but took out the code as it wasn’t needed.

However, the device gets the down scaled resolution every time. If WiFi is off, the resolution is correct but it’s the wrong resolution when WiFi is on

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

126 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

On Android: move a folder to the PersistentDataPath 1 Answer

Problem with persistentDataPath on Android 1 Answer

Android build restarts on uninstall 2 Answers

[Unity5.6 && Android] Application.persistentDataPath return always "external" storage regardless "write access" settings? 0 Answers

No Gamefolder created for mobile game (Nexus 4) 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges