ReactiveWiFi
ReactiveWiFi copied to clipboard
BroadcastReceiver.onReceive always run in the UI thread
return new BroadcastReceiver() {
@Override public void onReceive(Context context, Intent intent) {
wifiManager.startScan();
emitter.onNext(wifiManager.getScanResults());
}
};
BroadcastReceiver.onReceive always run in the UI thread, so getScanResults() and startScan still block ui thread
https://stackoverflow.com/questions/5674518/does-broadcastreceiver-onreceive-always-run-in-the-ui-thread
When we define subscription on the correct scheduler, then it should be executed in the background, but I'm not sure about that. According to this stackoverflow thread, just notification comes in the UI thread, what will be desired in the many cases. Nevertheless getting single notification should slow the app down significantly. I'll have a look at this.