204 Views

RNetwork is a light weight and lifecycle awared live internet connection status library based on rxnetwork and crouton.

How does another developer add this as a dependency?

STEP 1: Reference your Bintray repository into project-level build.gradle:

    allprojects {
      repositories {
        // ...
        maven { url 'https://dl.bintray.com/rrsaikat/RNetwork' }
      }
    }

STEP 2: Reference the library itself in your module-level build.gradle:

    implementation 'com.rezwan.knetworklib:knetworklib:1.0.3'

STEP 3: KNetwork.initialize(this) – must declare this into Application.

    class App:Application() {
        override fun onCreate() {
            super.onCreate()
            KNetwork.initialize(this)
        }
    }

STEP 4: KNetwork.bind(this, lifecycle) – bind the targeted activity in which you want to show network status.

    KNetwork.bind(this, lifecycle)
                   .setConnectivityListener(this)

Available additional methods:

*  showKNDialog() - set true for show dialog when net connection goes off.
*  setConnectivityListener() - connected, disconnected callback into activity
*  setInAnimation() - custom animation setup
*  setOutAnimation() - custom animation setup
*  setViewGroupResId() - targeted viewgroup to show network status views.

Here is the simple demonstration of this library:

Video Tutorial (Bonus) :

Explore and download the full project from Github

Follow me at :

github profile of rrsaikat
Find me at facebook
Author

Write A Comment