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
Crash OnErrorNotImplementedException #176
Comments
Hi, Thanks for reporting this issue. You're getting that error because you haven't implemented an error handling in your subscription and pinging In order to handle this error, you should use internetDisposable = ReactiveNetwork
.observeInternetConnectivity(5000, "www.google.com", 80, 10000)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<Boolean>() {
@Override
public void onSubscribe(final Disposable d) {
// this will be invoked before operation is started
}
@Override
public void onNext(final Boolean aBoolean) {
// do your action, when you're connected to the internet
}
@Override
public void onError(final Throwable e) {
// handle an error here
}
@Override
public void onComplete() {
// this will be invoked when operation is completed
}
}); Both Regards, |
I don't think so. |
If you want to observe the network connectivity is true or false then you should use default implementation But If you have your own custom details for checking Internet connectivity then you should Subscribe an Observer as @pwittchen mentioned. Using that way you can listen true and false in onNext method simply ignore other methods. ReactiveNetwork.observeInternetConnectivity()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<Connectivity>() {
@Override public void accept(Boolean isConnectedToInternet) {
// do something with isConnectedToInternet value
}
}); |
There may occur another error not related with the boolean state of the connection. For example, connection timeout, local network problem or something like that. In such cases, you'll receive an error. When I was testing this, I haven't encountered such issues and it worked fine with just |
thank you so much @pwittchen @Bhavdip. |
We discussed this issue, so I'm considering it as clarified and resolved. In the case of further problems, you can re-open this issue or create a new one. |
add second parameter in |
If I don't want to know about any error and only execute |
@javierpe You can do it, but while checking Internet connectivity many exceptions may occur. If you won't handle them, they will crash your app. You don't have to do anything in |
@pwittchen I m facing the same issue when I try to connected to 5G network otherwise it is working fine |
@Harmeetkaur01 for some reason, your device is crashing while trying to connect to 5G network. This issue depends on a particular device - not the library. In order to handle this error gracefully, implement error handler in the way @toe-pyae-sone-oo suggested in the comment above. |
I got this problem as well, and i think the fatal reason causes this problem is that Consumer only have accept, it seems like it have no catch error when some problem throws out. But Observer have onError() as we all know.
|
This is exactly what I'd been trying to achieve. Worked flawlessly. Thanks |
Tks .
The text was updated successfully, but these errors were encountered: