{"id":13609570,"url":"https://github.com/ezralazuardy/orb","last_synced_at":"2025-04-15T01:04:28.686Z","repository":{"id":50094079,"uuid":"260331210","full_name":"ezralazuardy/orb","owner":"ezralazuardy","description":"Android network monitoring made easy 🎉️","archived":false,"fork":false,"pushed_at":"2021-07-09T05:03:55.000Z","size":418,"stargazers_count":20,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-15T01:04:12.467Z","etag":null,"topics":["android","connectivitymanager","orb"],"latest_commit_sha":null,"homepage":"https://orb.ezralazuardy.com","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ezralazuardy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null},"funding":{"github":null,"patreon":"ezralazuardy","open_collective":null,"ko_fi":"ezralazuardy","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2020-04-30T22:26:14.000Z","updated_at":"2024-08-21T03:52:01.000Z","dependencies_parsed_at":"2022-09-23T09:53:11.040Z","dependency_job_id":null,"html_url":"https://github.com/ezralazuardy/orb","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ezralazuardy%2Forb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ezralazuardy%2Forb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ezralazuardy%2Forb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ezralazuardy%2Forb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ezralazuardy","download_url":"https://codeload.github.com/ezralazuardy/orb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248986313,"owners_count":21194025,"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":["android","connectivitymanager","orb"],"created_at":"2024-08-01T19:01:36.048Z","updated_at":"2025-04-15T01:04:28.658Z","avatar_url":"https://github.com/ezralazuardy.png","language":"Kotlin","funding_links":["https://patreon.com/ezralazuardy","https://ko-fi.com/ezralazuardy"],"categories":["Kotlin"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003ca href=\"https://orb.ezralazuardy.com\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\u003cimg width=\"200\" src=\"https://orb.ezralazuardy.com/img/orb.png\" alt=\"Orb\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.codacy.com/gh/ezralazuardy/orb/dashboard?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=ezralazuardy/orb\u0026amp;utm_campaign=Badge_Grade\"\u003e\u003cimg src=\"https://img.shields.io/codacy/grade/59899705560f4f62bf32ec72240161fb\" alt=\"code quality\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://codeclimate.com/github/ezralazuardy/orb\"\u003e\u003cimg src=\"https://img.shields.io/codeclimate/maintainability/ezralazuardy/orb\" alt=\"maintainability\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://circleci.com/gh/ezralazuardy/orb\"\u003e\u003cimg src=\"https://img.shields.io/circleci/build/github/ezralazuardy/orb\" alt=\"build status\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://sonarcloud.io/dashboard?id=ezralazuardy_orb\"\u003e\u003cimg src=\"https://sonarcloud.io/api/project_badges/measure?project=ezralazuardy_orb\u0026metric=security_rating\" alt=\"security\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://jitpack.io/#ezralazuardy/orb\"\u003e\u003cimg src=\"https://img.shields.io/github/v/release/ezralazuardy/orb\" alt=\"release\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://android-arsenal.com/api?level=15#l15\"\u003e\u003cimg src=\"https://img.shields.io/badge/API-16%2B-blue.svg\" alt=\"minimum API\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/ezralazuardy/orb/issues\"\u003e\u003cimg src=\"https://img.shields.io/github/issues/ezralazuardy/orb?color=red\" alt=\"issues\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/ezralazuardy/orb/blob/master/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/ezralazuardy/orb\" alt=\"license\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\nOrb is a lifecycle-aware asynchronous network monitoring library to simplify the needs of network state monitoring in Android. This library can help you monitor (observe) the current network state of Android device. It can give you the current connection status, and connection type in realtime change events without blocking the main thread. Orb really works well with the [MVVM architecture pattern](https://developer.android.com/jetpack/docs/guide#recommended-app-arch) in Android.\n\n#### How it works\nOrb is an implementation of [Android Live Data](https://developer.android.com/topic/libraries/architecture/livedata) that use an observable pattern to get the network state data in realtime. This is what makes Orb lifecycle-aware. Since the lifecycle of Live Data object is already handled automatically by Android lifecycle, you don't need to handle the Orb lifecycle manually. It's guarantee you to be flexible and no memory leak. You can just start Orb and forget about it, it'll handle the lifecycle based on your Activity lifecycle automatically.\n\nHow Orb determine the current network state and type is by using [ConnectivityManager](https://developer.android.com/reference/android/net/ConnectivityManager). And due to some Android ConnectivityManager API deprecation, applying network managing algorithm can be a little bit hard and tricky. Here's come Orb to the rescue. Orb is simple, powerful, sweet, and the most important, idiomatic!. It's written in pure Kotlin.\n\n#### Latest version\nSee the latest released Orb version [here](https://github.com/ezralazuardy/orb/releases).\n\n\u003cbr/\u003e\n\n## ✍️ Installation\n#### Gradle setup\n```gradle\n// project level gradle\nallprojects {\n    repositories {\n        maven { url 'https://jitpack.io' }\n    }\n}\n```\n```gradle\n// module level gradle\ndependencies {\n    implementation 'com.github.ezralazuardy:orb:$version' //replace '$version' with the latest version of orb\n}\n```\n\n#### Maven setup\n```xml\n\u003c!-- \u003crepositories\u003e section of pom.xml --\u003e\n\u003crepository\u003e\n    \u003cid\u003ejitpack.io\u003c/id\u003e\n   \u003curl\u003ehttps://jitpack.io\u003c/url\u003e\n\u003c/repository\u003e\n```\n```xml\n\u003c!-- \u003cdependencies\u003e section of pom.xml --\u003e\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.ezralazuardy\u003c/groupId\u003e\n    \u003cartifactId\u003eorb\u003c/artifactId\u003e\n    \u003cversion\u003eversion\u003c/version\u003e \u003c!-- replace 'version' with the latest version of orb --\u003e\n\u003c/dependency\u003e\n```\n\n\u003cbr/\u003e\n\n## 🚀️ Getting Started\n#### Manifest permission settings\nSince Orb API need to access and change the current network status of the device, you need to add the following permissions in you App manifest.\n```xml\n\u003cmanifest\u003e\n    \u003cuses-permission android:name=\"android.permission.INTERNET\" /\u003e\n    \u003cuses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" /\u003e\n    \u003cuses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\" /\u003e\n    ...\n\u003c/manifest\u003e\n```\n\n#### Using Orb\nOrb usage is pretty simple, you just need to initialize it in your current context (view), and the rest will be handled by Orb.\n\n```kotlin\nOrb.with(this).observe { response -\u003e\n    Log.d(this::javaClass.simpleName, response.toString())\n    // do something awesome..\n}\n```\n\nAll the action defined inside observe function will be converted into an observer. Make sure you've initialize the Orb only in the **onCreate()** function of your activity. Why?, because Orb only can observe a single observer and that need to be happened in the creation process of your activity.\n\nWhat if you want to change the observer?, like changing the observer action after you observing the Orb? or changing the observer action when each time Orb detecting network changes? to do that, please read more about Orb advanced usage in the [documentation](https://orb.ezralazuardy.com).\n\nIf you don't want to use a direct written observer, you can use the Orb observer function builder, and pass the observer to observe function parameter.\n\n```kotlin\n// use the Orb observer function builder\nval observer = orbObserver { response -\u003e\n  Log.d(this::javaClass.simpleName, response.toString())\n  // do something awesome..\n}\n\nOrb.with(this).observe(observer)\n```\n\nOrb observer will be called each time Orb is detecting network changes in the device. The observe function also gives you an **OrbResponse** that hold the network state information, so that you can interact with it.\n\nPlease note that Orb will observing the network asynchronously. It's mean that Orb will **not** blocking your main thread, resulting in hang and stuttering effect on Android screen. And Orb is also lifecycle-aware. You don't need to worry about memory leak, all already handled by Orb. You just need to focus on functionality of your app, and let Orb do all the network monitoring stuff.\n\n#### The OrbResponse\nThe observe method will return an **OrbResponse** object (accessible by keyword **it** by default) when each time Orb detecting a change in device network state. This object hold some properties as follows:\n\n| Property     | Value Type | Default Value    | Information                                    |\n| ------------ | ---------- | ---------------- | ---------------------------------------------- |\n| state        | OrbState   | OrbState.UNKNOWN | Current network state of the device            |\n| type         | OrbType    | OrbType.UNKNOWN  | Current network type of the device             |\n| errorMessage | String     | null             | The message when error happened in Orb process |\n\n\u003cbr/\u003e\n\n## 📖️ Documentation\nRead the Orb documentation [here](https://orb.ezralazuardy.com).\n\n\u003cbr/\u003e\n\n## 🤔️ Sample Implementation\nYou can try the sample implementation of Orb by cloning this repository to your local, and run the [sample](https://github.com/ezralazuardy/orb/tree/master/sample) module.\n\n\u003cbr/\u003e\n\n## 👷️ Contributing\nAll contributions are welcomed. Please make a [pull request](https://github.com/ezralazuardy/orb/pulls) so that I can review your changes.\n\nBefore start making contributions to Orb, please read the [contribution guidelines](https://github.com/ezralazuardy/orb/blob/master/CONTRIBUTING.md) and [code of conduct](https://github.com/ezralazuardy/orb/blob/master/CODE_OF_CONDUCT.md).\n\n\u003cbr/\u003e\n\n## 🛡️ Security Policy\nRead the current Orb's security policy [here](https://github.com/ezralazuardy/orb/security/policy).\n\n\u003cbr/\u003e\n\n## 🗒️ Side Note\nOrb is at it's early stage. If you experiencing an error or bug, please report it by creating a new [issues](https://github.com/ezralazuardy/orb/issues).\n\n\u003cbr/\u003e\n\n## 📜 License\n\u003ca href=\"https://app.fossa.com/projects/git%2Bgithub.com%2Fezralazuardy%2Forb?ref=badge_large\" alt=\"FOSSA Status\"\u003e\u003cimg src=\"https://app.fossa.com/api/projects/git%2Bgithub.com%2Fezralazuardy%2Forb.svg?type=large\"/\u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fezralazuardy%2Forb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fezralazuardy%2Forb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fezralazuardy%2Forb/lists"}