现在在哪里可以找到AndroidObservable.fromBroadcast?
Where can AndroidObservable.fromBroadcast be found now?
在 1.0.0 之前,RxAndroid which would be used to subscribe for broadcast in reactive way. It was mentioned in Grokking RxJava 中有 AndroidObservable
class 和 fromBroadcast
方法:
I also like AndroidObservable.fromBroadcast()
, which allows you to create an Observable
that works like a BroadcastReceiver
. 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));
在 1.0.0 之后,RxAndroid 放弃了很多功能并分裂成 RxAndroid 本身,现在只有线程的东西,RxLifecycle and RxBindings。
None 其中似乎包含 AndroidObservable
和 fromBroadcast
或 fromSharedPreferenceChange
。
它是否在某些实际和受支持的库中实现?
简而言之,它已被删除,我还不知道有任何替代品。
您可以看到 here that it was renamed to AppObservable
, and then here 它已从 1.0 版本中删除,他们做了一些清理工作。
似乎出现了一些严重的问题。
此功能was removed in 1.0 release as part of modularization effort. You can find a replacement in RxBroadcast。要使用它,请将依赖项添加到 build.gradle
:
compile 'com.cantrowitz:rxbroadcast:1.0.0'
并按如下方式使用:
Observable<Intent> = RxBroadcast.fromBroadcast(context, intentFilter);
在 1.0.0 之前,RxAndroid which would be used to subscribe for broadcast in reactive way. It was mentioned in Grokking RxJava 中有 AndroidObservable
class 和 fromBroadcast
方法:
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));
在 1.0.0 之后,RxAndroid 放弃了很多功能并分裂成 RxAndroid 本身,现在只有线程的东西,RxLifecycle and RxBindings。
None 其中似乎包含 AndroidObservable
和 fromBroadcast
或 fromSharedPreferenceChange
。
它是否在某些实际和受支持的库中实现?
简而言之,它已被删除,我还不知道有任何替代品。
您可以看到 here that it was renamed to AppObservable
, and then here 它已从 1.0 版本中删除,他们做了一些清理工作。
似乎出现了一些严重的问题。
此功能was removed in 1.0 release as part of modularization effort. You can find a replacement in RxBroadcast。要使用它,请将依赖项添加到 build.gradle
:
compile 'com.cantrowitz:rxbroadcast:1.0.0'
并按如下方式使用:
Observable<Intent> = RxBroadcast.fromBroadcast(context, intentFilter);