Data does not cleared in ionic storage


I have used ionic storage in my app. Also, I store token in storage while authenticating. But when I uninstall the app, the ionic stoarge is not getting deleted, and when I install it again the app is logged in with the previous user x, I experiencing this issue in some devices (Nexus, Redmi Note 3), whereas some other devices are not able to replicate this issue such as moto e.

Please suggest how to forcefully clear the ionic stoarge on uninstalling the app.


For Clearing Ionic Storage data of your app Programmatic I hope you tried Clear Method for Ionic Storage.

But to clear Application’s data in the device while uninstalling, you need to clear application data from the settings option in the whichever device you are using
In your device go to Settings >Apps >YourApp and hit the button Clear Data in order to clear data while uninstalling your Application.


Yes, I do have logout method where I have used storage.clear() method. but while uninstalling it won’t be called(assuming user unistall app without logout the app), so that the data from the storage is not cleared.

Manually data clear is not a solution, I need something that I will handle in code.


What you are experiencing is not not deleted data, but automatically restored data on reinstall of your app. iOS and Android started to back up local storage data to their cloud services a few versions ago.

Lucky for you, this can be configured in Cordova.

For iOS: (Search for “BackupWebStorage”)

For Android: (Note the “UPDATE” at the bottom of the post)

(Please report back if you make it work, the Android solutions still seem a bit rough)


Thanks for the help :slight_smile: It’s worked for me. But strangely solution for iOS also applies to android.


What did you set it to? I have my BackupWebStorage set to none and it still seems to be getting backup in the cloud for Android. What version of Ionic and Cordova were you using?


In addition to the above - if you run into unbound prefix error,
add the namespace for Android to the widget tag

<widget CFBundleShortVersionString="1.0.0" android-versionCode="65" android-versionName="1.0.0" id="" ios-CFBundleVersion="" version="1.0.0" xmlns="" xmlns:android="" xmlns:cdv="">
 <platform name="android">
        <edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application">
            <application android:allowBackup="false" />

open issue here:


Execution failed for task ‘:app:mergeDebugResources’.


Done it with adding to config.xml for platform android. Setting android backup to false