Delete SQLite database when uninstall App


when I uninstall my App, it seems like the SQLite Database wouldn’t deleted .

I uninstalled my App and installed it again and the data in DB are the same as before.

This is my code how I create the database:

    return this.db.openDatabase({
      name: 'resper.db',
      location: 'default'
    }).then(() => {
      this.db.executeSql('CREATE TABLE IF NOT EXISTS versions(id INTEGER PRIMARY KEY, name TEXT, nr INTEGER)',{}).then(() => {
        this.db.executeSql('INSERT OR IGNORE INTO versions VALUES (1,"medisMain",0)',{});
      this.db.executeSql('CREATE TABLE IF NOT EXISTS medis(id INTEGER PRIMARY KEY, wirk TEXT, form TEXT, formShort TEXT, indi TEXT, kontra TEXT, bem TEXT, erw TEXT, kind TEXT, handel TEXT, neben TEXT)',{});

with this line I insert a starting value in the database:

this.db.executeSql('INSERT OR IGNORE INTO versions VALUES (1,"medisMain",0)',{});

The third value will be increased by some actions wich do the user in the app. When I now uninstall the app from my phone an reinstall it, the value is the same as before and not 0.

Tested on my Android Samsung S6

1 Like

Can someone confirm this? I can’t find the db file on my smartphone, but it seems like the database is still there.

I haven’t experienced that. In my case, on uninstall, the database is always deleted.

Resper I have the same exact issue as you. I am using the update feature that ionic provides. When I make changes to my sqlite db and I use the update button, my database in the phone has not updated.
I tried using the window.plugins.sqlDB.remove method to remove the old db before the update so that my window.plugins.sqlDB.copy will copy the updated db from local storage to device.

Wonder if anyone knows how to remove the sqlite db from phone so that the same named sqlite db (with updated data) can be put into the device.

I have exactly the same issue on:

Cordova CLI: 6.4.0
Ionic CLI Version: 2.2.2
Ionic App Lib Version: 2.2.1

Any progress on this? I’m running into the exact same issue

I faced this problem and found the solution.
In the config.xml file, add this line <application android:allowBackup="false" />
in this place :

<platform name="android">
    <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="">
        <application android:networkSecurityConfig="@xml/network_security_config" />
        <application android:allowBackup="false" />

Thank you you saved me a lot of headache!