Before 1.0.0 there was AndroidObservable
class with fromBroadcast
method in RxAndroid which would be used to subscribe for broadcast in reactive way. It was mentioned in Grokking RxJava:
I also like
AndroidObservable.fromBroadcast()
, which allows you to create anObservable
that works like aBroadcastReceiver
. Here's a way to be notified whenever network connectivity changes:IntentFilter filter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION); AndroidObservable.fromBroadcast(context, filter) .subscribe(intent -> handleConnectivityChange(intent));
After 1.0.0, RxAndroid dropped a lot of functionality and splitted into RxAndroid itself which now has only threading stuff, RxLifecycle and RxBindings.
None of them seem to contain AndroidObservable
with fromBroadcast
or fromSharedPreferenceChange
.
Is it implemented in some actual and supported library?
This functionality was removed in 1.0 release as part of modularization effort. You can find a replacement in RxBroadcast. To use it add a dependency to build.gradle
:
compile 'com.cantrowitz:rxbroadcast:1.0.0'
And use it as follows:
Observable<Intent> = RxBroadcast.fromBroadcast(context, intentFilter);
In short, it has been removed and I don't know of any replacement yet.
You can see here that it was renamed to AppObservable
, and then here that it has been removed with the 1.0 release where they did quite some cleaning.
There seem to have been some severe issues.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With