Niklas Baudy edited this page Jun 9, 2018 · 31 revisions

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

Extensions

Q 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. (RxJava 1)
  • RxLocation - Reactive Location APIs Library for Android. (RxJava 2)
  • 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
  • RxPermission - Reactive permissions for Android
  • 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.
  • RxBroadcastReceiver - Simple RxJava2 binding for Android BroadcastReceiver
  • RxAndroidBle - Reactive library for handling Bluetooth LE devices.
  • RxImagePicker - Reactive library for selecting images from gallery or camera.
  • ReactiveNetwork - Reactive library listening network connection state and Internet connectivity (compatible with RxJava1.x and RxJava2.x)
  • ReactiveBeacons - Reactive library scanning BLE (Bluetooth Low Energy) beacons nearby (compatible with RxJava1.x and RxJava2.x)
  • ReactiveAirplaneMode - Reactive library listening airplane mode (compatible with RxJava2.x)
  • ReactiveSensors - Reactive library monitoring device hardware sensors with RxJava (compatible with RxJava1.x and RxJava2.x)
  • RxDataBinding - RxJava2 binding APIs for Android's Data Binding Library.
  • RxLocationManager - RxJava/RxJava2 wrap around standard Android LocationManager without Google Play Services.
  • RxDownloader - Reactive library for downloading files (compatible with RxJava2.x).

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
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.