{"id":18784494,"url":"https://github.com/pwittchen/reactiveairplanemode","last_synced_at":"2025-04-13T12:33:08.585Z","repository":{"id":57722217,"uuid":"99165764","full_name":"pwittchen/ReactiveAirplaneMode","owner":"pwittchen","description":"✈️ Android library listening airplane mode with RxJava Observables","archived":false,"fork":false,"pushed_at":"2020-08-19T08:49:26.000Z","size":346,"stargazers_count":8,"open_issues_count":2,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-27T03:35:18.830Z","etag":null,"topics":["airplane","airplane-mode","android","broadcast-reciever","rxandroid","rxandroid2","rxjava","rxjava2"],"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":"CONTRIBUTING.md","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":"2017-08-02T22:21:09.000Z","updated_at":"2021-08-30T17:55:39.000Z","dependencies_parsed_at":"2022-08-29T23:01:10.715Z","dependency_job_id":null,"html_url":"https://github.com/pwittchen/ReactiveAirplaneMode","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwittchen%2FReactiveAirplaneMode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwittchen%2FReactiveAirplaneMode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwittchen%2FReactiveAirplaneMode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwittchen%2FReactiveAirplaneMode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pwittchen","download_url":"https://codeload.github.com/pwittchen/ReactiveAirplaneMode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248714730,"owners_count":21149956,"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":["airplane","airplane-mode","android","broadcast-reciever","rxandroid","rxandroid2","rxjava","rxjava2"],"created_at":"2024-11-07T20:43:11.101Z","updated_at":"2025-04-13T12:33:08.174Z","avatar_url":"https://github.com/pwittchen.png","language":"Java","funding_links":["https://github.com/sponsors/pwittchen","https://paypal.me/pwittchen"],"categories":[],"sub_categories":[],"readme":"ReactiveAirplaneMode [![Build Status](https://travis-ci.org/pwittchen/ReactiveAirplaneMode.svg?branch=master)](https://travis-ci.org/pwittchen/ReactiveAirplaneMode) [![codecov](https://codecov.io/gh/pwittchen/ReactiveAirplaneMode/branch/master/graph/badge.svg)](https://codecov.io/gh/pwittchen/ReactiveAirplaneMode) ![Maven Central](https://img.shields.io/maven-central/v/com.github.pwittchen/reactiveairplanemode.svg?style=flat)\n====================\n✈️ Android library listening airplane mode with RxJava Observables\n\nThis library is compatible with RxJava2 and RxAndroid2.\n\nJavaDoc can be found at: https://pwittchen.github.io/ReactiveAirplaneMode/.\n\nContents\n--------\n\n- [Usage](#usage)\n- [Examples](#examples)\n- [Download](#download)\n- [Tests](#tests)\n- [Code style](#code-style)\n- [Static code analysis](#static-code-analysis)\n- [Changelog](#changelog)\n- [Releasing](#releasing)\n- [References](#references)\n- [License](#license)\n\nUsage\n-----\n\nWe can observe airplane mode in the following way:\n\n```java\nReactiveAirplaneMode.create()\n    .observe(context)\n    .subscribeOn(Schedulers.io())\n    .observeOn(AndroidSchedulers.mainThread())\n    .subscribe(isOn -\u003e textView.setText(String.format(\"Airplane mode on: %s\", isOn.toString())));\n```\n\nWhen airplane mode changes, subscriber will be notified with appropriate `Boolean` value (`true` if airplane mode is on or `false` otherwise).\n\nIf you're using this code in an `Activity`, don't forget to dispose `Disposable` in `onPause()` method just like in the sample app.\n\nPlease note that method above **will be called only when the airplane mode changes**.\n\nIf you want to **read airplane mode on start and then observe it**, you can use `getAndObserve(context)` method as follows:\n\n```java\nReactiveAirplaneMode.create()\n    .getAndObserve(context)\n    .subscribeOn(Schedulers.io())\n    .observeOn(AndroidSchedulers.mainThread())\n    .subscribe(isOn -\u003e textView.setText(String.format(\"Airplane mode on: %s\", isOn.toString())));\n```\n\nIf you want to **check airplane mode only once**, you can use `get(context)` method, which returns `Single\u003cBoolean\u003e` value:\n\n```java\nReactiveAirplaneMode.create()\n    .get(context)\n    .subscribeOn(Schedulers.io())\n    .observeOn(AndroidSchedulers.mainThread())\n    .subscribe(isOn -\u003e textView.setText(String.format(\"Airplane mode on: %s\", isOn.toString())));\n```\n\nIf you want to check airplane mode **only once without using Reactive Streams**, just call `isAirplaneModeOn(context)` method:\n\n```java\nboolean isOn = ReactiveAirplaneMode.create().isAirplaneModeOn(context);\n```\n\nExamples\n--------\n\nExemplary application is located in `app` directory of this repository.\n\nDownload\n--------\n\nYou can depend on the library through Maven:\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.pwittchen\u003c/groupId\u003e\n    \u003cartifactId\u003ereactiveairplanemode\u003c/artifactId\u003e\n    \u003cversion\u003e0.0.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nor through Gradle:\n\n```groovy\ndependencies {\n  compile 'com.github.pwittchen:reactiveairplanemode:0.0.1'\n}\n```\n\nTests\n-----\n\nTests are available in `library/src/test/java/` directory and can be executed on JVM without any emulator or Android device from Android Studio or CLI with the following command:\n\n```\n./gradlew test\n```\n\nTo generate test coverage report, run the following command:\n\n```\n./gradlew test jacocoTestReport\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, 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\nChangelog\n---------\n\nSee [CHANGELOG.md](https://github.com/pwittchen/ReactiveAirplaneMode/blob/master/CHANGELOG.md) file.\n\nReleasing\n---------\n\nSee [RELEASING.md](https://github.com/pwittchen/ReactiveAirplaneMode/blob/master/RELEASING.md) file.\n\nReferences\n----------\n- https://stackoverflow.com/questions/4319212/how-can-one-detect-airplane-mode-on-android\n- https://stackoverflow.com/questions/5533881/toggle-airplane-mode-in-android\n\nLicense\n-------\n\n    Copyright 2017 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%2Freactiveairplanemode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpwittchen%2Freactiveairplanemode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpwittchen%2Freactiveairplanemode/lists"}