Is Android persistent user data available after an app update? - android

I'm sure it's a dumb question. But still. User activity is saved to storage (Internal/External) and SharedPreferences. Will it be available after update of the app?
Thanks for answers!

Welcome to SO!
On an update all app data remains. That's for updates that you install manually with adb or updates that get rolled out from PlayStore. This also means that if you have changes in your data model from one version to the next you'll have to make sure the new version can handle the old data.
If the app get uninstalled and reinstalled the data is usually lost but there are some instances where the OS can create backups of app data and it reappears even when an app gets uninstalled and reinstalled. See allowBackup for this.

Related

At what point does the app data restoration happen when installing an Android app

My question is concerning the Android app data backup feature configured by android:allowBackup in the manifest, as documented here. As I understand it, this backed-up app data is restored when the user uninstalls and later re-installs an app from the play store.
In this scenario, when exactly is the data restoration done? Is it:
During installation from Play Store, before user has ability to open app
After installation is complete, potentially allowing user to open app before the restore is done
Our users are on slow internet connections and a few have reported scenarios where data they entered shortly after a reinstall is replaced by old data from past backups. If the Google backups are to blame, this seems to suggest that the restore is done after install (#2 above), but I can't find concrete information to back this.
I'm slightly skeptical because this backup feature is enabled by default. If this overwriting can indeed happen on reinstalls, this would mean all android apps under android 6+ will have encountered issues where first-time setup data (auth tokens and such) is overwritten when a restore is applied. Does anyone have any links or anecdotal information on whether this theory is correct?
Auto backup in android
Check "Restore schedule" para which says that restore happens after the APK is installed, but before the app is available to be launched by the user. BTW if you want to handle Autobackup, you can follow the setup step on codelab Autobackup setup for Android Codelab

When submitting an updated APK, can I force previous versions to be uninstalled?

I'm submitting an update to my APK on Google Play, and I want any previous versions of the app to be uninstalled before the updated version is installed. Is there any way to make this happen, on a technical level?
No you cannot require the apk be uninstalled first. However you can handle this gracefully. On app start store the app version in SharedPreferences then each app start should check if the the version changed. If the version changed then delete your app's preferences and this should give them a fresh install state.
No, that depends on the user.
The solution i use is to force update using a server and a version number.
A popup to lock user out.
But why do you need to uninstall?
Worst case you can clear all his data via code.

Does changing the android:label of my application require users to reinstall the app?

I recently deployed an android app to the play store. The client noticed that the app's title was not correct in the app list so I ended up changing it by modifying the android:label in both the application node as well as the activity node for the launcher activity. My question is, should the client have to re-install the app or not? I can't seem to find a concrete answer to this and they claim they had to re-install the app in order to get the icon title to update. Simply updating the app through the Google Play store did not fix the issue.
EDIT TO CLARIFY:
I am not referring to the store listing. I am referring to the title just below the app icon when viewing the list of apps installed on the phone. The customer is claiming that performing an update through the Google Play store did not fix this, but uninstalling and reinstalling the application manually did.
My question is, should the client have to re-install the app or not?
Any change you made to the app requires installation of new build for users too see the change on their devices, but there's no need to reinstall (uninstall and fresh install) and ordinary upgrade (so app data remains unaffected) perfectly suffices.
EDIT
"But there's no need to full reinstall (uninstall and fresh install)"
this is what the client is claiming they had to do
There's insufficient information and my experience tells that customers often claim nonsenses (or they simply do not understand the difference between upgrade/reinstall), still there's also a chance Launcher your user uses is buggy or somehow affected (i.e. I just spotted possible bug with quite popular Nova, that is also not showing one app label correctly). IMHO there's nothing you should bother here.
You users will either have to reinstall or update. These are essentially the same things, however updating allows a user to keep his or her application data between different versions (local data you may have saved that affects the user's personal experience).
The only kind of updates that you can get away with without updating the app are either things controlled via the Google play console OR server side data / synchronised data you may have in the app, however data like your static label is only controlled via the application package and thus must be updated / reinstalled.

Parse.com - Installation on update?

I am using parse.com for my backend database. My app is already published and I am adding a push notifications from parse. First I need to keep track of my installations. But I have many users already that do not have an installation object saved for their device.
My question is: when the user updates the app, will this count as an install?
The reason I wonder, is cause I had an older version on my emulator, and updated it (with android studio) and it did not create an installation object for it.
This is how I save my installations:
ParseInstallation.getCurrentInstallation().saveInBackground();
On a fresh install, it will save the install object without a problem. Any suggestions? Let me know if you need any more info.
After updating my app on google play and my users that updated the app are being considered as a new install to parse. So there is no need to worry about specifically handling users with older versions. Hope this helps someone.

How do I force uninstall first?

When I update some applications, I see some show "Manual update". I believe this will force uninstall of old version first and the installs fresh.
1. Is it true?
2. How do I FORCE uninstall of new version (with all preferences etc.), and install the new version fresh?
The manual update isn't going to uninstall your application, then reinstall, what is happening is because the dev has changed a security requirement of the app, the user needs to agree to it again.
So for example, if I developed a word search app with no security requirements, the user agrees to install it and uses it so decides to tick the auto update, or hits update all. My first update is simply adding puzzles - it would update fine.
I now add a feature to read a users SMS and their Contacts and use the internet to send me all the details.
The security privileges of my app have changed - now my app will not be included in the auto update or update all as the user needs to agree to these new security privileges and thus hopefully alerting the user to the outrages nature of the security requirements for this type of app.
Read More Here
If what you are trying to achieve is wiping all users data, then you need to add this to your code as I don't think it is possible to do this as a market update option (I could be wrong as its not something I would normally recommend).
To do it in code, a simple look at the app version code, and if its below X then delete prefs & or DB would do the trick I would have thought.

Categories

Resources