O'Reilly logo

Reactive Android Programming by Tadas Subonis

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Settings for monitored tweets

We will use a very similar approach for the monitored tweets. The settings here are retrieved using this:

settings.getMonitoredKeywords()

However, the .switchMap() block is a bit expanded here:

.switchMap(keywords -> {            if (keywords.isEmpty()) {                return Observable.never();            }            String[] trackingKeywords = keywords.toArray(new                 String[0]);            final FilterQuery filterQuery = new FilterQuery()                    .track(trackingKeywords)                    .language("en");            return createTweetStockUpdateObservable(configuration,                        trackingKeywords, filterQuery);        })

Here, we have included the following:

if (keywords.isEmpty()) {   return Observable.never();}

This will ensure that the Observables return early if there are no monitored keywords. We could have ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required