View on GitHub

RxWifi

A Reactive library for WiFi scanning on Android

Download this project as a .zip file Download this project as a tar.gz file

RxWifi

This library has been built in order to help us in retrieving the different networks in range of the device providing the result as an Observable instead of relying on usual Android's Receiver paradigm.

Disclaimer

RxWifi is being developed an it is provided as is (please check the license for further information)

Importing

Gradle

Add the JitPack repo to the root build.gradle file of your project:

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

Add the RxWifi library between the dependencies of your app

compile 'com.github.Ennova-IT:RxWifi:1.2'

Maven

Add the JitPack repo to your build file

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

Add the dependency

<dependency>
    <groupId>com.github.Ennova-IT</groupId>
    <artifactId>RxWifi</artifactId>
    <version>1.2</version>
    </dependency>

Usage

The main entry point of the library will provide you with an Hot Observable by simply invoking the static factory method and passing the Context as input parameter.

RxWifi.from(context)

Alternatively, you can request multiple scans of the available networks, so that you can leverage the network data changes.
This method will return a List<ScanResult> multiple times (once per iteration).

RxWifi.from(context, times)

Note: this command can take up to 10 seconds per scan, so it is running (by default) on a proper Scheduler so that it does not block the UI.

As a bonus, we added a converter from the ScanResult class to a WiFiNetwork one so that it is easier to show simpler information to the user

ScanResultUtils.toWiFiNetwork(scanResult)

Open points