BroadcastReceiver.onReceive always run in the UI thread
wangsuicheng opened this issue · 1 comments
wangsuicheng commented
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
pwittchen commented
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.