Oziomajnr / RxNetworkInfo

Observe Android network connectivity state as Rx Streams

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RxNetworkInfo

Observe Android network connectivity state as Rx Streams

Installation

gradle:

Step 1. Add the JitPack repository to your build file

Add it in your root build.gradle at the end of repositories:

	allprojects {
		repositories {
			...
			maven {url 'https://jitpack.io'}
		}
	}

Step 2. Add the dependency

	dependencies {
	        implementation 'com.github.Oziomajnr:RxNetworkInfo:0.0.1'

maven:

Step 1. Add the JitPack repository to your build file

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Step 2. Add the dependency

	<dependency>
	    <groupId>com.github.Oziomajnr</groupId>
	    <artifactId>RxNetworkInfo</artifactId>
	    <version>0.0.1</version>
	</dependency>

How to use

Get the instance of InternetConnectionHelper and subscribe to the internetConnected Flowable

e.g

disposable.add(internetConnectionHelper.internetConnectionAvailable.observeOn(  
    AndroidSchedulers.mainThread()  
).subscribe {  
  Toast.makeText(this, it.toString(), Toast.LENGTH_LONG).show()  
    })

See Demo Activity for a concrete example

Backlog

Support sdk <21

About

Observe Android network connectivity state as Rx Streams


Languages

Language:Kotlin 100.0%