Search code examples
androidrealm

Android realm, app uninstall


I have a simple android app with a realm db/2 tables.

When I uninstall my application, all the realm databases/tables are deleted from my app, or not?


Solution

  • Fundamentally, yes. The database and tables are deleted on uninstall.

    However, there exists cases when they are not deleted.

    Gotten from https://github.com/realm/realm-java/issues/2992

    When you uninstall the application, your /data/data/com.example.acme folder should be erased. If you're specifically opening the Realm on the external storage (and not inside of your internal storage dedicated data folder as per context.getFilesDir()), then the Realm file will not be removed.

    The Realm.getDefaultInstance() and Realm.getInstance(Context) calls open the Realm in getFilesDir(), which means it should be deleted along with the application.

    Maybe you're being a victim of the new Android's auto-backup feature?