Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BroadcastReceiver.onReceive always run in the UI thread #75

Open
wangsuicheng opened this issue Jul 7, 2020 · 1 comment
Open

BroadcastReceiver.onReceive always run in the UI thread #75

wangsuicheng opened this issue Jul 7, 2020 · 1 comment

Comments

@wangsuicheng
Copy link

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

@pwittchen
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants