Skip to content Skip to sidebar Skip to footer

Polling Using Rxjava2 / Rxandroid 2 And Retrofit

i would like to implement a Pollingservice which calls a REST Api every nDelay Seconds and notify all subscribers if the data has been changed. Now i have a little problem with my

Solution 1:

what about using some custom filter?

public class FilterDuplicateHueConfig implements Predicate<HueConfig> {

   private HueConfig lastVal;
   @Override 
   public boolean test(HueConfig newVal) {
      if(lastVal == null) {
         lastVal = newVal;
         return true;
      }
      ... compare here the two values and return true/false appropriately...
   }
}

Post a Comment for "Polling Using Rxjava2 / Rxandroid 2 And Retrofit"