Uploaded image for project: 'Realm Java SDK'
  1. Realm Java SDK
  2. RJAVA-294

Data lost after restart application Realm version 4.1.1

      <!---

      Questions: If you have questions about how to use Realm, ask on
      StackOverflow.
      We monitor the realm tag.

      Feature Request: Just fill in the first two sections below.

      Bugs: To help you as fast as possible with an issue please describe your issue
      and the steps you have taken to reproduce it in as many details as possible.

      -->

      Goal

      > What do you want to achieve?
      I have issue with realm that make data lost after once time restart application. I used multple file realm with difference config and not manually delete data.

      Expected Results

      > ?

      Actual Results

      > E.g. full stack trace with exception
      User used app with large data ( maybe, i'm not sure about that ). After once restart application, all data lost. In the below code, I only init and compact realm into Application oncreate()

      Steps & Code to Reproduce

      > Describe your current debugging efforts.

      Code Sample

      try

      { Realm.init(this); initRealm(); Realm.compactRealm(getRealmConfig()); Intent intent1 = new Intent(context, BreastfeedingService.class); context.startService(intent1); }

      catch (Error e)

      { e.printStackTrace(); outMemoryRealm = true; } catch (Exception e) { e.printStackTrace(); outMemoryRealm = true; }

      public void initRealm()

      { String lastRealm = SharedPreferencesHelper.getStringValue(AppConstants.LAST_REALM); RealmConfiguration.Builder _config = new RealmConfiguration.Builder(); _config.name(lastRealm + ".realm"); _config.schemaVersion(CURRENT_REALM_VERSION); _config.migration(new MyRealmMigration()); RealmConfiguration config = _config.build(); realmConfigurationHashMap.put(lastRealm, config); // Realm.setDefaultConfiguration(config); }

      > Your code here. Bigger samples should ideally be as separate Android Studio project,
      > in gists/repositories or privately at help@realm.io)

      ```

      Version of Realm and tooling

      Realm version(s): ?
      classpath 'io.realm:realm-gradle-plugin:4.1.1'
      Realm sync feature enabled: no

      Android Studio version: ?
      Android studio 3.0.1
      Which Android version and device: ?
      Android version 7.0 and 7.1.1

            Assignee:
            Unassigned Unassigned
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: