Delete all data when the user uninstalls my application - Androd

0

Hello good morning everyone.

A few weeks ago I launched an update of my application to the Play Store, and everything normal. My surprise comes when some users have a problem, which was presented when they had already installed the application, but they had eliminated it. So at the moment of wanting to install it again it does not run in the way it should.

In my app I use sessions by facebook, then if they had already logged in, they could enter directly without even going through the Login (Since it is valid first that they must be "Logeados" to be able to pass to the MainActivity). This causes you to skip certain necessary steps in the application.

Before trying to change code in my application, I was wondering if there is a way in which when deleting my application also delete all temporary and non-temporary files that this genre.

Thank you very much in advance.

    
asked by Alan Oliver 27.09.2018 в 04:56
source

1 answer

0

Hello, it is normal to think that when you uninstall an app, the referral to that app is eliminated, including the SharedPreference and temporary data. But in practice many times it seems not to be like this and this happens because Android has a backup system. When you update the app to a newer version or change the phone, it is safest for the app to use the backup to recover the previous data and for the user to lose nothing. For us who are programming and testing things this can be very annoying, I personally use a method to clean my sharedpreference every time I need to try some things where I can bring problems, for example when I try the login.

One solution that does not happen to you in theory is to set allowBackup to false within the manifest.

<application ...
   android:allowBackup="false">
   ...
</application>

However, many devices do not take into account that you put false to the allowBackup and they will keep the data anyway. So to be sure you can also use fullBackupContent='false' in the manifest.

While this may work and prevent you from changing the code, I recommend that you change the code to support the path in which there is still data saved. Your application would be more robust, it would not depend on the whims of the different versions of Android and the adaptations made by the manufacturers. In addition, for the end user it is always more convenient for the app to remember its session without problems.

    
answered by 27.09.2018 / 17:06
source