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

observeWifiAccessPoints suddenly doesn't work #8

Closed
inijimenez opened this issue Sep 2, 2015 · 4 comments
Closed

observeWifiAccessPoints suddenly doesn't work #8

inijimenez opened this issue Sep 2, 2015 · 4 comments
Assignees
Labels

Comments

@inijimenez
Copy link

my app was being used successfully observeWifiAccessPoints and observeConnectivity and suddenly observeWifiAccessPoints has stopped working (now never goes to "call" procedure).

This is my code:

@Override
protected void onResume() {
    super.onResume();
    // Register interest for two different actions related to power
    registerReceiver(powerMonitor, new IntentFilter("android.intent.action.ACTION_POWER_CONNECTED"));
    registerReceiver(powerMonitor, new IntentFilter("android.intent.action.ACTION_POWER_DISCONNECTED"));


    reactiveNetwork = new ReactiveNetwork();

    reactiveNetwork.observeConnectivity(this)
            .observeOn(AndroidSchedulers.mainThread())
            .subscribeOn(Schedulers.io())
            .subscribe(new Action1<ConnectivityStatus>() {
                @Override
                public void call(ConnectivityStatus connectivityStatus) {
                    Toast.makeText(MainActivity.this, "connectivityStatus", Toast.LENGTH_SHORT).show();
                    tvConnectivityStatus.setText(connectivityStatus.toString());
                }
            });

    reactiveNetwork.observeWifiAccessPoints(this)
            .observeOn(AndroidSchedulers.mainThread())
            .subscribeOn(Schedulers.io())
            .subscribe(new Action1<List<ScanResult>>() {
                @Override
                public void call(List<ScanResult> scanResults) {
                    Toast.makeText(MainActivity.this, "observeWifiAccessPoints", Toast.LENGTH_SHORT).show();
                    displayAccessPoints(scanResults);
                }
            });
}
@pwittchen
Copy link
Owner

Thank you for reporting the issue.
Does it happen all the time? I think it may be related to bug or bad design of Android SDK. I've seen on StackOverflow that people have similar problems with WiFi scanning.

Related threads:

I will check this out and try to fix it within library.

@pwittchen
Copy link
Owner

It looks that problem was caused by lack of WifiManager.SCAN_RESULTS_AVAILABLE_ACTION filter for BroadcastReceiver. Now it should work fine. Moreover, I've slightly updated sample app.
Fix will be available in the next release. If you want to verify it now, you can clone repository and check sample app.

@pwittchen
Copy link
Owner

@inigo-jimenez release of version 0.0.4 is available now on Maven Central.
Please, check download section.

@inijimenez
Copy link
Author

fixed!! well done, thanks!

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

No branches or pull requests

2 participants