Skip to content

java.lang.IllegalArgumentException: intervalInMs is not a positive number #474

Description

@Mokardder
   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)

Activity

  1. pwittchen commented on Feb 8, 2025

    @pwittchen
    Owner

    Thanks for reporting this. It looks weird. This error should not occur if the interval is configured correctly. I will have a look at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions