Realm-java: Realm database not empty after clear all data on app.

Created on 28 Feb 2017  路  9Comments  路  Source: realm/realm-java

Goal

What do you want to achieve?

One of my users had a very weird experience, that I cannot replicate. Somehow after the user cleared app data via the settings, and cleared the cache, the Realm database did not delete? That's my assumption right now. The user had to login again, but they were in a similar broken state to when before (which shouldn't have been the case).

I have now fixed the broken state on my side, but I want to know, is it possible for the Realm database to not be deleted/empty when clearing app data? Maybe if it's just an edge case.

Expected Results

When i relaunch the app after clearing data, I do not want old data.

Actual Results

App data is somehow still there.

Steps & Code to Reproduce

I am unable to replicate the issue which is annoying. When I clear app data, everything is fine. The app is in a brand new state.

Version of Realm and tooling

Realm version(s): 2.2.3

Realm sync feature enabled: no

Android Studio version: 2.2.3

Which Android version and device: Issue happened to a user on Nexus 5X with 7.1.2. I cannot replicate on nexus 5 with 6.0

T-Help

Most helpful comment

android:fullBackupContent="false"
android:allowBackup="false"

I have set backup false still in my android 10 devices its not deleting realm data after app uninstall
can anyone help me with this?

All 9 comments

Is it possible that the app was running while the app data was cleared? If the Realm file was in use when the button was pressed it will not be deleted.

I was under the assumption that the app was killed when clearing data? The app was in the background, but yes running.

I haven't checked myself recently, but we have seen other reports from people saying similar things, and manually killing the app fixed it. Possible it is a bug on specific versions of Android.

In any case, it is not really something we as a library can do much about, so I'll close this issue.

I am having the same issue. If I uninstall the app and reinstall it, the app crashes because it's picking up the contract of the old realm database on my phone. However if I clear data, it loses the data. Wondering if there's a particular place realm stores app data other than the app data folder?

@abhinavmanchanda try to debug with RealmConfiguration.getPath().
by default, realm files are in the internal files dir.

For me, it might be a device issue, not a realm issue.

A signed apk of my app crashes on my phone because of realm incompatibility (I haven't released yet, so I did not bother writing a migration), even if I've uninstalled the app.

Strangely, if I clear data and open the apk again, it works.

When I install the debug version of my app, everything works, but if I uninstall and reinstall the release version, it again stops working - it picks up the old version of app data from last month, and crashes because of realm incompatibility.

@abhinavmanchanda
do you have android auto backup enabled? That will restore realm file after app installed before the first launch.

Good point @beeender . I have it enabled. So that's the reason. I verified it by trying a different signature for my apk - it does not restore the data.

Thank you for your help, and sorry for hijacking your thread.

android:fullBackupContent="false"
android:allowBackup="false"

I have set backup false still in my android 10 devices its not deleting realm data after app uninstall
can anyone help me with this?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jjorian picture jjorian  路  3Comments

wezley98 picture wezley98  路  3Comments

CNyezi picture CNyezi  路  3Comments

aschrijver picture aschrijver  路  3Comments

mithrann picture mithrann  路  3Comments