Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why defining Flowable I could receive updates of the DB

 @Query("SELECT * FROM userdata")
 Flowable<List<UserData>> allUserDatas();

@Insert(onConflict = OnConflictStrategy.REPLACE)
List<Long> insert(List<UserData> datas);


userDao.allUserDatas()
take(1).
filter(....)
    .subscribeOn(io())
    .observeOn(mainThread())
    .subscribe(userDatas -> Log.i("TAG",""+userDatas));

I added fetching with subscription in the same fragment in onAttach() but after DB update it doesn't call the subscription of fetching from DB, why

like image 229
I.S Avatar asked Aug 12 '17 22:08

I.S


1 Answers

I found the problem.

It was because of take(1), as it makes complete and that is why I could not listen to changes. Removing take(1) fixed that.

like image 151
I.S Avatar answered Oct 02 '22 15:10

I.S