Android auto backup (Offline data sync)

  

Hi all,

I have a question about a problem I have got with the android app created and build with Outsystems. The auto backup mode is enabled for the local database in the Android build which is made with Outsystems. Therefore the local database will not be removed if the app will be removed. If you reinstall the app and run the offline data sync after removing it, you will see your old data back or the same data double from the local databases.

Has anyone got the same problem and does somebody know an option or setting to clean the local database of the Android app build with Outsystems?

Thanks,

Furkan

Hi Furkan,

What do you mean with "auto backup mode"? I would think that if an app that has created a local database is removed, that database is also always removed. I have never seen the behaviour you described (the database retaining the data etc.).

Hi Kilian, 

Android has this option. I have got this problem on Android devices multiple times. The local database was not removed after removing and reinstalling the app. The previously synchronized data in the local database was not removed. If you go to the app settings of the android device and remove the user data and dump the cache of the app this problem is solved, but this is not the way how it must be. 


Ok, I didn't know that option. But it seems that this is explicitly meant to restore data after the app is reinstalled, so it makes perfect sense it is retained. So I'm not at all certain the data is retained locally, but it is retained in the cloud, and copied back (restored) when you reinstall the app.

The data is always available on the cloud and will be synchronized and stored in the local database during the login. This is not user specific data but it is master data which could be used in the app by the users also in offline mode. I hope that you understand this part. After reinstalling the app this data is not removed which is stored in the first installation. 

Well, I know nothing of the mechanisms involved, I have to rely on the documentation. But it seems to me that if you explicitly tell Android to keep your data, that it keeps your data, and restores the data if you first remove and then reinstall the app.

Keeping the data is the default in my case. I want to tell the Android version of the app explicitly that it must remove the stored data. That should be a solution, but how is that possible? 

Solution

Hi Furkan,

to do that we need to explicitly change the default behavior in the AndroidManifest.xml file. In order to do that we need a plugin.

I've managed to create it for you, and it's already in the forge.

https://www.outsystems.com/forge/component/3698/allowbackup-android-plugin/


Add a reference to the plugin in your app, build it, and reinstall it in order to make use of the new plugin.


Cheers,
Miguel

Solution

Hi Miguel,

Thank you very much.