2

I am testing my app on multiple phones. When the app is installed the app walks the user through some basic registrations and app initialization - then some of that info is written to localstorage. The app install process looks for specific variables/files and if they don't exist or are not set it assumes a new install.

when the app is uninstalled all that local storage/files content is supposed to be wiped out. This is the case on all but one of the devices I am testing on.

MotoX works
Samsung Galaxy S5 works
iPhone 6 & 7 work
LG K20 Plus does not work.

After uninstalling the app from the phone (1: long click on app and move to trash can (asks to uninstall), 2: then I go into Settings -> Apps and still see the app listed there - I then delete it from there.) the localstorage data is still there.

When I reinstall the app on that LG device it somehow is still seeing all the local storage content and files and thus bypasses the app initialization and registration. That content isn't actually getting deleted when the app is fully uninstalled from the phone.

I am not certain how to manage this and makes me wonder how much this is happening on different phone types. Why isn't app uninstall fully removing the app; why is it leaving some stuff in localstorage?

Is there a way for an app to know its being uninstalled and have it remove/delete that extra content? Is there a mechanism in the app to let the "uninstaller" fully remove all contents related to the app?

rolinger
  • 2,787
  • 1
  • 31
  • 53

1 Answers1

2

Well...after some significant research I found this:

<edit-config file="AndroidManifest.xml"
             target="/manifest/application"
             mode="merge">
    <application android:allowBackup="false"/>
</edit-config>

Seems Google was feeding my phone all the backed up localstorage/files every time I did a fresh install on my app. Whats odd though is that this not happening on my other test phones - so why just the LG?

After adding the above to my cordova/ionic "config.xml" file the problem went away. For native apps the above <application /> get added directly to the AndroidManifest.xml file.

rolinger
  • 2,787
  • 1
  • 31
  • 53
  • And upon further review, the one LG phone has "Settings -> Backup * Reset -> Automatic Restore" set to ON. `Automatic Restore: When reinstalling an app, restore backed up settings and data`. This option wasn't set on the other phones. Good to know though...for testing purposes def need this feature turned off. But for general app deployments to the public, should I allow or not allow `android:allowBackup` . Gonna have to think this one through. – rolinger Jun 12 '17 at 21:48
  • One more note for newbies: need add xmlns:android="http://schemas.android.com/apk/res/android" in surrounding widget tag as described here: https://stackoverflow.com/questions/30527107/how-to-add-androidallowbackup-false-via-cordova-plugin – user2686101 Mar 25 '20 at 14:00