ReactiveNetwork
ReactiveNetwork copied to clipboard
Doesn't notify when connection is restored after restarting the router
Describe the bug When i restart the router, i get notified that connection is lost but i never get notified when it's restored.
To Reproduce Steps to reproduce the behavior:
The code:
ReactiveNetwork.observeNetworkConnectivity(applicationContext)
.flatMap { network ->
ReactiveNetwork.checkInternetConnectivity()
.toObservable()
.map { network.state() to it }
}.map {
val (networkState, isInternetAvailable) = it
return when {
isInternetAvailable -> // connected
networkState == NetworkInfo.State.CONNECTING -> // connecting
networkState == NetworkInfo.State.DISCONNECTED -> // disconnected
else -> // disconnected
}
}.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ /* ... */ }, { it.printStackTrace() })
- run the app (using WIFI, haven't tested it with data)
- restart the router (the app never gets notified when connection is restored)
Smartphone (please complete the following information):
- Device: Huawei Y7 Prime 2018
- OS: Android 8
- Library Version: 3.0.3
Thanks for reporting that. I'll have a look at this issue.
-- Piotr Wittchen, http://wittchen.io
pon., 22 lip 2019, 14:59 użytkownik Ahmed Mourad [email protected] napisał:
Describe the bug When i restart the router, i get notified that connection is lost but i never get notified when it's restored.
To Reproduce Steps to reproduce the behavior:
The code:
ReactiveNetwork.observeNetworkConnectivity(applicationContext) .flatMap { network -> ReactiveNetwork.checkInternetConnectivity() .toObservable() .map { network.state() to it } }.map {
val (networkState, isInternetAvailable) = networkInfo return when { isInternetAvailable -> // connected networkState == NetworkInfo.State.CONNECTING -> // connecting networkState == NetworkInfo.State.DISCONNECTED -> // disconnected else -> // disconnected } }.subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe({ /* ... */ }, { it.printStackTrace() })
- run the app (using WIFI, haven't tested it with data)
- restart the router (the app never gets notified when connection is restored)
Smartphone (please complete the following information):
- Device: Huawei Y7 Prime 2018
- OS: Android 8
- Library Version: 3.0.3
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pwittchen/ReactiveNetwork/issues/357?email_source=notifications&email_token=AAFJYF2R2KBU4YDWXHYANCLQAWVLXA5CNFSM4IFYLNCKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HAUEJAA, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFJYF37P56YTC3RVEH46Y3QAWVLXANCNFSM4IFYLNCA .
That'd be great, thank you!