Skip to content
Glade Diviney edited this page Sep 23, 2016 · 18 revisions

RxAndroid adds the minimum classes to RxJava that make writing reactive components in Android applications easy and hassle-free.

Extensions

Since it cannot provide every type of binding to Android in one place, a variety of third-party add-ons are available to fill in the gaps:

  • RxLifecycle - Lifecycle handling APIs for Android apps using RxJava
  • RxBinding - RxJava binding APIs for Android's UI widgets.
  • SqlBrite - A lightweight wrapper around SQLiteOpenHelper and ContentResolver which introduces reactive stream semantics to queries.
  • Android-ReactiveLocation - Library that wraps location play services API boilerplate with a reactive friendly API.
  • rx-preferences - Reactive SharedPreferences for Android
  • RxFit - Reactive Fitness API Library for Android
  • RxWear - Reactive Wearable API Library for Android
  • RxPermissions - Android runtime permissions powered by RxJava
  • RxNotification - Easy way to register, remove and manage notifications using RxJava
  • RxClipboard - RxJava binding APIs for Android clipboard.
  • RxBroadcast - RxJava bindings for Broadcast and LocalBroadcast.

Note: this list is not for libraries which simply use RxJava to expose observables but for specifically those which aim to make interacting with Android APIs reactive.

Upgrading

The move from 0.25.0 to 1.x is a big one; here's an overview of what can be done (from here).

RxAndroid

AndroidSchedulers is all that remains in RxAndroid, though some method signatures have changed.

Moved

WidgetObservable and ViewObservable have been rolled into (and improved in) RxBinding.

LifecycleObservable has been moved to RxLifecycle. In addition, they've gone through a fairly extensive behavior refactor, so make sure to check the changelogs.

ContentObservable.fromSharedPreferencesChanges() has been moved (and improved) by rx-preferences.

Orphaned

The rest of ContentObservable has yet to make the move. This could be a good project for someone looking to do some open source work!

ReactiveDialog has not been moved to a new project.

Removed

AppObservable and its bind methods have been completely eradicated. There were a number of problems with it:

  1. It tried to auto-unsubscribe, but it would only do so if the sequence emitted an item after the Activity or Fragment paused. As a consequence, sequences that never end might never unsubscribe.
  2. It was designed to defend against notifications after pause, but it appears that bug only occurred due to a subtle logic issue in the HandlerScheduler.
  3. It automatically called observeOn(AndroidSchedulers.mainThread()), whether you wanted it or not.

In other words: it didn't do what it claimed to do, it was overly defensive, and it had undesirable side effects.

When removing it, make sure to:

  1. Use manual Subscription handling (or RxLifecycle) to unsubscribe from the sequence properly.
  2. Check whether you need to add observeOn(AndroidSchedulers.mainThread()) to the sequence.
Clone this wiki locally