Database won't remove when uninstall the Android Application

in Android 6.0, google added new feature called Auto Backup.

when this option is on(default is on), Android system copies almost every directories and files that created by system, and upload it to user's google drive account.

When user reinstalls app, android automatically restore app's data, no matter how it was installed(via Play store, adb install, initial device setup).

The restore operation occurs after the APK is installed, but before the app is available to be launched by the user.

android developers page : https://developer.android.com/guide/topics/data/autobackup.html


GUI WAY

If this is a personal account and you need to delete the backup for testing, you can go to drive.google.com for your account and navigate to the backups section.

Select a backup and you are given the option to delete the backups for a specific device:

Select backups and then a backup to delete

ADB SHELL WAY

You can also do this from the command line with the following:

adb shell bmgr wipe com.google.android.gms/.backup.BackupTransportService com.example.app

You can find more details related to this command here:

http://www.androiddocs.com/tools/help/bmgr.html#other

ADB SHELL BACKUP MANAGER USAGE

The usage for the command can be found here:

https://github.com/aosp-mirror/platform_frameworks_base/blob/6f357d3284a833cc50a990e14b39f389b8972254/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java#L443

    System.err.println("usage: bmgr [backup|restore|list|transport|run]");
    System.err.println("       bmgr backup PACKAGE");
    System.err.println("       bmgr enable BOOL");
    System.err.println("       bmgr enabled");
    System.err.println("       bmgr list transports");
    System.err.println("       bmgr list sets");
    System.err.println("       bmgr transport WHICH");
    System.err.println("       bmgr restore TOKEN");
    System.err.println("       bmgr restore TOKEN PACKAGE...");
    System.err.println("       bmgr restore PACKAGE");
    System.err.println("       bmgr run");
    System.err.println("       bmgr wipe TRANSPORT PACKAGE");
    System.err.println("");
    System.err.println("The 'backup' command schedules a backup pass for the named package.");
    System.err.println("Note that the backup pass will effectively be a no-op if the package");
    System.err.println("does not actually have changed data to store.");
    System.err.println("");
    System.err.println("The 'enable' command enables or disables the entire backup mechanism.");
    System.err.println("If the argument is 'true' it will be enabled, otherwise it will be");
    System.err.println("disabled.  When disabled, neither backup or restore operations will");
    System.err.println("be performed.");
    System.err.println("");
    System.err.println("The 'enabled' command reports the current enabled/disabled state of");
    System.err.println("the backup mechanism.");
    System.err.println("");
    System.err.println("The 'list transports' command reports the names of the backup transports");
    System.err.println("currently available on the device.  These names can be passed as arguments");
    System.err.println("to the 'transport' and 'wipe' commands.  The currently selected transport");
    System.err.println("is indicated with a '*' character.");
    System.err.println("");
    System.err.println("The 'list sets' command reports the token and name of each restore set");
    System.err.println("available to the device via the current transport.");
    System.err.println("");
    System.err.println("The 'transport' command designates the named transport as the currently");
    System.err.println("active one.  This setting is persistent across reboots.");
    System.err.println("");
    System.err.println("The 'restore' command when given just a restore token initiates a full-system");
    System.err.println("restore operation from the currently active transport.  It will deliver");
    System.err.println("the restore set designated by the TOKEN argument to each application");
    System.err.println("that had contributed data to that restore set.");
    System.err.println("");
    System.err.println("The 'restore' command when given a token and one or more package names");
    System.err.println("initiates a restore operation of just those given packages from the restore");
    System.err.println("set designated by the TOKEN argument.  It is effectively the same as the");
    System.err.println("'restore' operation supplying only a token, but applies a filter to the");
    System.err.println("set of applications to be restored.");
    System.err.println("");
    System.err.println("The 'restore' command when given just a package name intiates a restore of");
    System.err.println("just that one package according to the restore set selection algorithm");
    System.err.println("used by the RestoreSession.restorePackage() method.");
    System.err.println("");
    System.err.println("The 'run' command causes any scheduled backup operation to be initiated");
    System.err.println("immediately, without the usual waiting period for batching together");
    System.err.println("data changes.");
    System.err.println("");
    System.err.println("The 'wipe' command causes all backed-up data for the given package to be");
    System.err.println("erased from the given transport's storage.  The next backup operation");
    System.err.println("that the given application performs will rewrite its entire data set.");
    System.err.println("Transport names to use here are those reported by 'list transports'.");

I cam across this question when I was looking for a solution to a similar problem related to GreenDao - slightly more in depth answer here but basically if your on api 23 you'll need to set allowBackup to false to be able to depend on the databases being cleared when you uninstall

https://stackoverflow.com/a/43046256/5298819