Android App Development
iOS App Development
Flutter App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 188.8.131.52 release ready!
Have you ever wondered that despite uninstalling your application there is some data in your application when you reinstall it?
All we think is that the data was somewhere in shared preference and it was not deleted when we uninstalled the application.But that is simply not the case.
The shared preference is definitely deleted when the application is uninstalled. So what is the cause for this and how do we rectify it.
The Reason for this unwanted data is not the Shared Preference but is the “BackupManager”.
Since Android API 23 ( or Android “6.0” or Android “Marshmellow”) the BackupManager stores all the data of an application including the Shared preference on the cloud. Thus when your application is reinstalled, the shared preference data is restored.
A key point here to note is that the process of backup is like a black-box. We cannot know when it started, how it started and when will next cycle of backup occur. So if you are thinking of disabling backup process, or to set the shared preference data just before backup that is perhaps not possible for now.
Another key point to note is that when we create an application in android, in the manifest file the key “allowBackup” is set to true by default.
Solution 1: Your App Should warn the user to disable the Automatic Restore feature on the Android device. For this, the user needs to go to the path
Settings–> Backup & Reset–>Automatic restore and then turn the switch off.
But this is not recommended, as this will turn off the automatic backup feature for all the applications installed on the device.
Solution 2: Go to your Manifest File. In the application tag, find the attribute “allowBackup” and set it to false.
On the precautionary note, you can also check for keys “fullBackupContent” and “fullBackupOnly”. and set them to false.
And “tools:replace” =”android:allowBackup” add this line too.
It is Done.
For further help regarding this, you can check the official document here.
That’s all for now.
We can also explicitly set the rules for what data should be included in the auto backup, which we will see some another time.
Also, we can externally set up a backupAgent and store the data we want to save after disabling the automatic BackUp process, which we will also learn some other time.
Keep coding and Keep Sharing 🙂
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.