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

Getting call for connectivity changes periodically on Samsung Note3 Neo #215

Closed
AbdullahUsmani opened this issue Aug 24, 2017 · 6 comments
Closed

Comments

@AbdullahUsmani
Copy link

AbdullahUsmani commented Aug 24, 2017

I have the following code in my app::

ReactiveNetwork.observeNetworkConnectivity(this)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Action1<Connectivity>() {
                    @Override
                    public void call(Connectivity connectivity) {
                        if(mCurrentActivity != null) {
                            if (connectivity.getState() == NetworkInfo.State.DISCONNECTED) {
                                Timber.i("Connection lost");
                            } else if (connectivity.getState() == NetworkInfo.State.CONNECTED) {
                                Timber.i("Connected");
                            }
                        }
                    }
                });

It is working fine on most of the devices I tested (Oneplus X, Samsung J5 etc). The 'call' method of 'Action1' gets called once whenever internet connection is lost or retained. But on Samsung Note3 Neo, Android v5.1.1, it gets called again and again.

@pwittchen
Copy link
Owner

pwittchen commented Aug 24, 2017

Hi,

Thanks for reporting this issue.

If this problem occurs only on the mentioned device, it may be device specific problem. What do you mean by "gets called again and again"? Does it get called continuously in an endless loop? This may be related to Android version customized by Samsung. To be honest, I tested this library only on "pure" Android OS on Nexus 5 & 6 and I haven't checked it on Samsung devices.

@AbdullahUsmani
Copy link
Author

AbdullahUsmani commented Aug 30, 2017

Thanks for your response.
Yes, it gets called continuously. Ideally, I should get a callback whenever a change in connectivity happens, i.e, when internet gets connected or disconnected. But I am getting this callback in an endless loop.

Like, it keeps on logging "Connected" every 4-5 seconds. Then when I disconnect the internet, it keeps logging "Connection lost" every 4-5 seconds.

@pwittchen
Copy link
Owner

pwittchen commented Aug 30, 2017 via email

@AbdullahUsmani
Copy link
Author

I think I am using the library correctly. Because I am getting the correct results on all other devices. This must be a device/OS specific issue.
I haven't tried the sample app though. I'll check it and let you know soon.

@pwittchen
Copy link
Owner

pwittchen commented Aug 30, 2017 via email

@pwittchen
Copy link
Owner

There's no new response since one year and it's related to the specific device, so I'm closing it.

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