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

Internet connectivity issue: Could not establish connection with WalledGardenStrategy #464

Open
mirwisek opened this issue Aug 10, 2022 · 1 comment

Comments

@mirwisek
Copy link

Internet connected state is misleading
I added the library to my projects and I'm only observing internet connectivity. It is always returning false even when my wifi is working fine. To confirm that, I observed network state and it is returning CONNECTED while internet connectivity is showing false.

To Reproduce
Steps to reproduce the behavior:

  1. I just tested the Kotlin sample nothing fancy

Expected behavior
It should show that internet is connected while Network state is CONNECTED

Screenshots
If applicable, add screenshots to help explain your problem.

Smartphone:

  • Device: Xaiomi Pocco F3
  • OS: Android 12
  • Library Version: v3.0.8-rx2

Error

I'm continuously getting the following error after each 2 seconds. It seems the library is pinging a URL that is http (Not permitted).

E/ReactiveNetwork: Could not establish connection with WalledGardenStrategy
    java.io.IOException: Cleartext HTTP traffic to clients3.google.com not permitted
        at com.android.okhttp.HttpHandler$CleartextURLFilter.checkURLPermitted(HttpHandler.java:127)
        at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:462)
        at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:411)
        at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:542)
        at com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.strategy.WalledGardenInternetObservingStrategy.isConnected(WalledGardenInternetObservingStrategy.java:109)
        at com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.strategy.WalledGardenInternetObservingStrategy$1.apply(WalledGardenInternetObservingStrategy.java:66)
        at com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.strategy.WalledGardenInternetObservingStrategy$1.apply(WalledGardenInternetObservingStrategy.java:64)
        at io.reactivex.internal.operators.observable.ObservableMap$MapObserver.onNext(ObservableMap.java:57)
        at io.reactivex.internal.operators.observable.ObservableInterval$IntervalObserver.run(ObservableInterval.java:82)
        at io.reactivex.Scheduler$PeriodicDirectTask.run(Scheduler.java:532)
        at io.reactivex.Scheduler$Worker$PeriodicTask.run(Scheduler.java:479)
        at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
        at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:920)
@pwittchen
Copy link
Owner

pwittchen commented Aug 10, 2022

Thanks for reporting this issue. It looks like clear text traffic configuration is missing. Please, have a look at this paragraph: https://github.com/pwittchen/ReactiveNetwork#cleartext-traffic .
Moreover, if you want to use WalledGardenInternetObservingStrategy, please update HTTP response code via InternetObservingSettings. E.g set it to 200 because default is 204. You can also try to set different custom host for checking connectivity via InternetObsevingSettings if clients3.google.com does not work in your country.

All of that is described in details in documentation in README.md.

Regards,
Piotr

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