RNetwork

A light weight and lifecycle awared live internet connection status library using reactivenetwork and crouton.

top

bottom

How To

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)

NOTE:

  1. Enable java 8:

     compileOptions {
         sourceCompatibility JavaVersion.VERSION_1_8
         targetCompatibility JavaVersion.VERSION_1_8
     }
    

Available additinal 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.

Example project is here for better understanding:
GO TO Example

Proguard

################ rxjava2 ###########
-dontwarn java.util.concurrent.Flow*
##### END ##############

##ReactNetwork####
-dontwarn com.github.pwittchen.reactivenetwork.library.rx2.ReactiveNetwork
-dontwarn io.reactivex.functions.Function
-dontwarn rx.internal.util.**
-dontwarn sun.misc.Unsafe
##END#####

Apps that are used this library:

Get it on Google Play

Author

? RRSaikat

GitHub