Description
InternetObservingSettings settings = InternetObservingSettings.builder()
.interval(20 * 1000)
.strategy(new SocketInternetObservingStrategy())
.build();
try {
internetDisposable = ReactiveNetwork.observeInternetConnectivity(settings)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(isConnected -> {
if (isConnected) {
Utility.sendAnyUnsentDAC(getApplicationContext());
}
});
} catch (Exception e) {
Log.e(Utility.TAG, "Error observing connectivity: " + e.getMessage(), e);
}
Log ---------------------------------
java.lang.IllegalArgumentException: intervalInMs is not a positive number
at com.github.pwittchen.reactivenetwork.library.rx2.Preconditions.checkGreaterThanZero(Preconditions.java:65)
at com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.strategy.SocketInternetObservingStrategy.observeInternetConnectivity(SocketInternetObservingStrategy.java:53)
at com.github.pwittchen.reactivenetwork.library.rx2.ReactiveNetwork.observeInternetConnectivity(ReactiveNetwork.java:149)
at com.github.pwittchen.reactivenetwork.library.rx2.ReactiveNetwork.observeInternetConnectivity(ReactiveNetwork.java:123)
at android.iocl.dac_collector.Ui.MainActivity.observeConnectivity(MainActivity.java:556)
at android.iocl.dac_collector.Ui.MainActivity.onCreate(MainActivity.java:109)
at android.app.Activity.performCreate(Activity.java:8130)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1357)