Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web Storage in Cordova app get carried over even if app is removed

In a Cordova Android app, when I use Web storage (window.localStorage), I notice that sometimes when I uninstall the app (even via adb uninstall) and rebuild the app again, window.localStorage stuff appears to get carried over.

This is not just on one Android device, I noticed it several time over different devices.

Is that even possible or is it just the pages got cached?

EDIT:

I created a sample project. And using Cordova 8 and Android platform 7.0.0. Am configuring it right?

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.example.hello" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>HelloWorld</name>
    <description>
        A sample Apache Cordova application that responds to the deviceready event.
    </description>
    <author email="[email protected]" href="http://cordova.io">
        Apache Cordova Team
    </author>
    <content src="index.html" />
    <plugin name="cordova-plugin-whitelist" spec="1" />
    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <platform name="android">
        <allow-intent href="market:*" />
        <edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application">
            <application android:allowBackup="false" />
            <application android:fullBackupContent="false" />
        </edit-config>
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
    </platform>
    <engine name="android" spec="^7.0.0" />
</widget>
like image 324
huggie Avatar asked Oct 19 '25 13:10

huggie


1 Answers

Android 6+ automatically does backup of the data and it's restored when you install the app again.

You can disable it by adding this to the config.xml

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

That makes the app build fail, you have to add xmlns:android="http://schemas.android.com/apk/res/android" to the config.xml widget to make it build.

like image 109
jcesarmobile Avatar answered Oct 22 '25 02:10

jcesarmobile



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!