{"id":18784465,"url":"https://github.com/pwittchen/reactivewifi","last_synced_at":"2025-10-23T17:16:46.533Z","repository":{"id":57722223,"uuid":"59886956","full_name":"pwittchen/ReactiveWiFi","owner":"pwittchen","description":"Android library listening available WiFi Access Points and related information with RxJava Observables","archived":false,"fork":false,"pushed_at":"2020-08-17T13:23:04.000Z","size":332,"stargazers_count":192,"open_issues_count":10,"forks_count":39,"subscribers_count":6,"default_branch":"RxJava2.x","last_synced_at":"2025-04-10T01:11:10.218Z","etag":null,"topics":["access-point","android","rxandroid","rxandroid2","rxjava","rxjava2","scanner","wifi"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pwittchen.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["pwittchen"],"custom":["https://paypal.me/pwittchen"]}},"created_at":"2016-05-28T09:24:01.000Z","updated_at":"2024-11-28T06:45:19.000Z","dependencies_parsed_at":"2022-08-29T23:01:11.399Z","dependency_job_id":null,"html_url":"https://github.com/pwittchen/ReactiveWiFi","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/pwittchen/ReactiveWiFi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwittchen%2FReactiveWiFi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwittchen%2FReactiveWiFi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwittchen%2FReactiveWiFi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwittchen%2FReactiveWiFi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pwittchen","download_url":"https://codeload.github.com/pwittchen/ReactiveWiFi/tar.gz/refs/heads/RxJava2.x","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwittchen%2FReactiveWiFi/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264357296,"owners_count":23595576,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["access-point","android","rxandroid","rxandroid2","rxjava","rxjava2","scanner","wifi"],"created_at":"2024-11-07T20:43:06.595Z","updated_at":"2025-10-23T17:16:41.513Z","avatar_url":"https://github.com/pwittchen.png","language":"Java","funding_links":["https://github.com/sponsors/pwittchen","https://paypal.me/pwittchen"],"categories":[],"sub_categories":[],"readme":"# ReactiveWiFi [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-ReactiveWiFi-brightgreen.svg?style=true)](https://android-arsenal.com/details/1/3913)\n\nAndroid library listening available WiFi Access Points and related information with RxJava Observables.\n\n| Current Branch | Branch  | Artifact Id | Build Status  | Maven Central |\n|:--------------:|:-------:|:-----------:|:-------------:|:-------------:|\n| | [`RxJava1.x`](https://github.com/pwittchen/ReactiveWifi/tree/RxJava1.x) | `reactivewifi` | [![Build Status for RxJava1.x](https://travis-ci.org/pwittchen/ReactiveWiFi.svg?branch=RxJava1.x)](https://travis-ci.org/pwittchen/ReactiveWiFi) | ![Maven Central](https://img.shields.io/maven-central/v/com.github.pwittchen/reactivewifi.svg?style=flat) |\n| :ballot_box_with_check: | [`RxJava2.x`](https://github.com/pwittchen/ReactiveWifi/tree/RxJava2.x) | `reactivewifi-rx2` | [![Build Status for RxJava2.x](https://travis-ci.org/pwittchen/ReactiveWiFi.svg?branch=RxJava2.x)](https://travis-ci.org/pwittchen/ReactiveWiFi) | ![Maven Central](https://img.shields.io/maven-central/v/com.github.pwittchen/reactivewifi-rx2.svg?style=flat) |\n\nThis library is one of the successors of the [NetworkEvents](https://github.com/pwittchen/NetworkEvents) library. Its functionality was extracted from [ReactiveNetwork](https://github.com/pwittchen/ReactiveNetwork) project to make it more specialized and reduce number of required permissions required to perform specific task.\n\nIf you are searching library for observing network or Internet connectivity check [ReactiveNetwork](https://github.com/pwittchen/ReactiveNetwork) project.\n\nJavaDoc is available at: http://pwittchen.github.io/ReactiveWiFi/RxJava2.x\n\nContents\n--------\n\n- [Usage](#usage)\n  - [Observing WiFi Access Points](#observing-wifi-access-points)\n  - [Observing WiFi signal level](#observing-wifi-signal-level)\n  - [Observing WiFi information changes](#observing-wifi-information-changes)\n  - [Observing WPA Supplicant state changes](#observing-wpa-supplicant-state-changes)\n  - [Observing WiFi State changes](#observing-wifi-state-changes)\n- [Examples](#examples)\n- [Download](#download)\n- [Code style](#code-style)\n- [Static code analysis](#static-code-analysis)\n- [License](#license)\n\nUsage\n-----\n\nLibrary has the following RxJava Observables available in the public API:\n\n```java\nObservable\u003cList\u003cScanResult\u003e\u003e observeWifiAccessPoints(final Context context)\nObservable\u003cInteger\u003e observeWifiSignalLevel(final Context context, final int numLevels)\nObservable\u003cWifiSignalLevel\u003e observeWifiSignalLevel(final Context context)\nObservable\u003cSupplicantState\u003e observeSupplicantState(final Context context)\nObservable\u003cWifiInfo\u003e observeWifiAccessPointChanges(final Context context)\nObservable\u003cWifiState\u003e observeWifiStateChange(final Context context)\n```\n\n**Please note**: Due to memory leak in `WifiManager` reported\nin [issue 43945](https://code.google.com/p/android/issues/detail?id=43945) in Android issue tracker\nit's recommended to use Application Context instead of Activity Context.\n\n### Observing WiFi Access Points\n\n**Please note**: If you want to observe WiFi access points on Android M (6.0) or higher, you need to [request runtime permission](https://developer.android.com/training/permissions/requesting.html) for `ACCESS_COARSE_LOCATION` or `ACCESS_FINE_LOCATION`. After that, location services have to be enabled. See sample app in `app` directory to check how it's done. User needs to enable Location manually. You can suggest him or her to do it via `AccessRequester` class from this library as follows:\n\n```java\nif (!AccessRequester.isLocationEnabled(this)) {\n  AccessRequester.requestLocationAccess(this);\n} else {\n  // observe WiFi Access Points\n}\n```\n\nIf you need more customization (e.g. custom title and message of the dialog window or custom listener), check public API of the `AccessRequester` class.\n\nWe can observe WiFi Access Points with `observeWifiAccessPoints(context)` method. Subscriber will be called everytime, when strength of the WiFi Access Points signal changes (it usually happens when user is moving around with a mobile device). We can do it in the following way:\n\n```java\nReactiveWifi.observeWifiAccessPoints(context)\n    .subscribeOn(Schedulers.io())\n    ... // anything else what you can do with RxJava\n    .observeOn(AndroidSchedulers.mainThread())\n    .subscribe(scanResults -\u003e {\n      // do something with ScanResults\n    });\n```\n\n**Hint**: If you want to operate on a single `ScanResult` instead of `List\u003cScanResult\u003e` in a `subscribe(...)` method, consider using `flatMap(...)` and `Observable.from(...)` operators from RxJava for transforming the stream.\n\n### Observing WiFi signal level\n\nWe can observe WiFi signal level with `observeWifiSignalLevel(context, numLevels)` method. Subscriber will be called everytime, when signal level of the connected WiFi  changes (it usually happens when user is moving around with a mobile device). We can do it in the following way:\n\n```java\nReactiveWifi.observeWifiSignalLevel(context, numLevels)\n    .subscribeOn(Schedulers.io())\n    ... // anything else what you can do with RxJava\n    .observeOn(AndroidSchedulers.mainThread())\n    .subscribe(level -\u003e {\n      // do something with level\n    });\n```\n\nWe can also observe WiFi signal level with `observeWifiSignalLevel(final Context context)` method, which has predefined num levels value, which is equal to 4 and returns `Observable\u003cWifiSignalLevel\u003e`. `WifiSignalLevel` is an enum, which contains information about current signal level. We can do it as follows:\n\n```java\nReactiveWifi.observeWifiSignalLevel(context)\n    .subscribeOn(Schedulers.io())\n    ... // anything else what you can do with RxJava\n    .observeOn(AndroidSchedulers.mainThread())\n    .subscribe(level -\u003e {\n      // do something with level\n    });\n```\n\n`WifiSignalLevel` has the following values:\n\n```java\npublic enum WifiSignalLevel {\n  NO_SIGNAL(0, \"no signal\"),\n  POOR(1, \"poor\"),\n  FAIR(2, \"fair\"),\n  GOOD(3, \"good\"),\n  EXCELLENT(4, \"excellent\");\n  ...\n}\n```\n\n### Observing WiFi information changes\n\nWe can observe WiFi network information changes with `observeWifiAccessPointChanges(context)` method. Subscriber will be called every time the WiFi network the device is connected to has changed. We can do it in the following way:\n\n```java\nReactiveWifi.observeWifiAccessPointChanges(context)\n    .subscribeOn(Schedulers.io())\n    ... // anything else what you can do with RxJava\n    .observeOn(AndroidSchedulers.mainThread())\n    .subscribe(wifiInfo -\u003e {\n      // do something with wifiInfo\n    });;\n```\n\n### Observing WPA Supplicant state changes\n\nWe can observe changes in the WPA Supplicant state with `observeSupplicantState(context)` method. Subscriber will be called every time the WPA Supplicant will change its state, getting information at a lower level than usually available. We can do it in the following way:\n\n```java\nReactiveWifi.observeSupplicantState(context)\n    .subscribeOn(Schedulers.io())\n    ... // anything else what you can do with RxJava\n    .observeOn(AndroidSchedulers.mainThread())\n    .subscribe(state -\u003e {\n      // do something with state\n    });\n```\n\n### Observing WiFi state changes\n\nWe can observe wifi state change with `observeWifiStateChange(context)` method. Subscriber will be called every time whenever the wifi state change such like enabling,disabling,enabled and disabled. We can do it in the following way:\n\n```java\nReactiveWifi.observeWifiStateChange(context)\n    .subscribeOn(Schedulers.io())\n    ... // anything else what you can do with RxJava\n    .observeOn(AndroidSchedulers.mainThread())\n    .subscribe(state -\u003e {\n      // do something with level\n    });\n```\nExamples\n--------\n\nExemplary application is located in `app` directory of this repository.\n\nIf you want to use this library with Kotlin, check `app-kotlin` directory.\n\nDownload\n--------\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.pwittchen\u003c/groupId\u003e\n    \u003cartifactId\u003ereactivewifi-rx2\u003c/artifactId\u003e\n    \u003cversion\u003e0.3.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nor through Gradle:\n\n```groovy\ndependencies {\n  implementation 'com.github.pwittchen:reactivewifi-rx2:0.3.0'\n}\n```\n\nCode style\n----------\n\nCode style used in the project is called `SquareAndroid` from Java Code Styles repository by Square available at: https://github.com/square/java-code-styles.\n\nStatic code analysis\n--------------------\n\nStatic code analysis runs Checkstyle, FindBugs, PMD and Lint. It can be executed with command:\n\n ```\n ./gradlew check\n ```\n\nReports from analysis are generated in `library/build/reports/` directory.\n\nLicense\n-------\n\n    Copyright 2016 Piotr Wittchen\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpwittchen%2Freactivewifi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpwittchen%2Freactivewifi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpwittchen%2Freactivewifi/lists"}