Let's say I have the following insertAll function:
@Insert
void insertDogs(List<Dog> dogs);
And
public long[] insertDogs(List<Dog> dogs) {
return appDatabase.dogDao().insertDogs(dogs)
.subscribeOn(Schedulers.io()) //causes Cannot resolve method 'subscribeOn(io.reactivex.Scheduler)'
.observeOn(AndroidSchedulers.mainThread());
}
What is the correct return value of bulk insert should be? If I want to receive the new created ids of the dogs, I receive the above mentioned error.
Is it enough to just put try catch outside insertDogs function, as subscribeOn does not work as it seems for bulk inserts.
Try using :-
@Insert
long[] insertDogs(List<Dog> dogs);