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

Question about detecting no internet connection in WiFi access point #35

Open
KonradSzewczuk opened this issue Oct 2, 2018 · 3 comments
Labels

Comments

@KonradSzewczuk
Copy link

Is the library able to detect when Android device is connected to WiFi AP but the access point has just lost the internet connection?

I want to react on such case and e.g show WiFi icon with exclamation mark (like on native status bar)

@pwittchen
Copy link
Owner

pwittchen commented Oct 2, 2018

Yes, it's possible, but not with this library :). ReactiveWiFi is dedicated just to monitoring available WiFi APs around. If you want to detect a situation when device is connected to the WiFi or Internet or both or connection is lost, you can have a look at ReactiveNetwork library, which is my another project. Especially, you can have a look at Chaining network and Internet connectivity streams section in the documentation. In your case, you may need flatMap(...) operator instead of flatMapSingle(...) if you want to observe internet and network connectivity continuously.

@KonradSzewczuk
Copy link
Author

@pwittchen Yes, but I assume i still need to subscribe to two observables:

ReactiveNetwork.observeInternetConnectivity()
and
ReactiveNetwork.observeNetworkConnectivity(applicationContext)

I've just thought it would be nice to have this ability in one Observable of the library API of yours

@pwittchen
Copy link
Owner

Library does not provide such observable because different users have different use cases and I don't know if there's general solution for that. You can combine these two observables into one using flatMap(...) like in the example I linked above. Then you can subscribe it only once. You can adjust this example to your needs and within the flatMap(...) operator return e.g. network type and boolean value indicating if device is connected to the internet (not only the boolean like in the example).

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