Where should I place the code so that the data is NOT overwritten and added several times? That is, I need to save the data to the rialm only once at the first launch, using the following code:
Realm realm = Realm.getDefaultInstance(); Task item = new Task(); item.setName("Item1"); item.setSubname("SubItem1"); item.setId(UUID.randomUUID().toString()); item.setTimestamp(System.currentTimeMillis()); realm.beginTransaction(); realm.copyToRealm(item); realm.commitTransaction(); realm.close(); .