{"id":21997744,"url":"https://github.com/osfunapps/android-lib-broadcast-receiver","last_synced_at":"2026-04-16T17:39:28.593Z","repository":{"id":98761999,"uuid":"132778075","full_name":"osfunapps/android-lib-broadcast-receiver","owner":"osfunapps","description":"An android library for broadcast receviers","archived":false,"fork":false,"pushed_at":"2018-05-27T18:39:13.000Z","size":83,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-23T04:45:15.295Z","etag":null,"topics":["android","application","broadcastreceiver","dagger2-mvp","kotlin","library","mvp-architecture","observer-pattern"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/osfunapps.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-09T15:35:27.000Z","updated_at":"2020-02-24T02:18:21.000Z","dependencies_parsed_at":"2023-05-25T05:15:20.882Z","dependency_job_id":null,"html_url":"https://github.com/osfunapps/android-lib-broadcast-receiver","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/osfunapps/android-lib-broadcast-receiver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osfunapps%2Fandroid-lib-broadcast-receiver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osfunapps%2Fandroid-lib-broadcast-receiver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osfunapps%2Fandroid-lib-broadcast-receiver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osfunapps%2Fandroid-lib-broadcast-receiver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/osfunapps","download_url":"https://codeload.github.com/osfunapps/android-lib-broadcast-receiver/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osfunapps%2Fandroid-lib-broadcast-receiver/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272116857,"owners_count":24876268,"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","status":"online","status_checked_at":"2025-08-25T02:00:12.092Z","response_time":1107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","application","broadcastreceiver","dagger2-mvp","kotlin","library","mvp-architecture","observer-pattern"],"created_at":"2024-11-29T22:17:54.621Z","updated_at":"2026-04-16T17:39:28.562Z","avatar_url":"https://github.com/osfunapps.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# An easy Broadcast Receiver library for Android.\n\n## Introduction\n\nThis library meant to handle all of the Broadcast Receiver operations using the Observer design pattern, to keep updating all of the broadcast listeners. \n\nFor example, by using this library you can keep track of the app network status, no matter where are you in your app. \nJust inject the NetworkReceiver object to your instance and you good to go!\n\nThis library works on Google's Dagger 2.1 android design, the recommended app architecture by Google.\n\n## Installing\n\n### Gradle:\n\nadd the gradle dependency:\n\n```groovy\ndependencies {\n    implementation 'com.github.osfunapps:android-lib-broadcast-receiver:v1.0.2'\n }   \n```\n\n## Usage\n\n1) add the library module **BroadcastReceiverLibraryBuilder::class** to your core component (singleton one).\n\n    Example:\n    ```\n    @Singleton\n    @Component(modules = [\n      AppModule::class,\n      NetworkModule::class,\n      ...\n      BroadcastReceiverLibraryBuilder::class])\n    ```\n    \n    \n2) add the desired broadcast receiver to your instance:\n\n  We will add the network receiver to the MainPresenter.kt, for example:\n  ```\n  @Module\n  class MainActivityModule {\n\n    //the main activity view\n    @Provides\n    fun provideMainView(mainActivity: MainActivity) : MainActivityView = mainActivity\n\n    //the main presenter\n    @Provides\n    @PerActivity\n    fun provideMainPresenter(mainActivityView: MainActivityView, networkReceiver: NetworkReceiver): MainActivityPresenterImpl {\n        return MainActivityPresenterImpl(mainActivityView, networkReceiver)\n    }\n\n}\n   ```\n   \n   \n3) inject the receiver to your presenter:\n\n```\nclass MainActivityPresenterImpl @Inject constructor(private var view: MainActivityView,\n                                                    private var networkReceiver: NetworkReceiver) : NetworkObserver {\n```\n\n\n4) subscribe your instance to get calls:\n```\n fun viewReady() {\n        //view.onPresenterReady()\n        networkReceiver.create()\n        networkReceiver.register(view.getActivity())\n        networkReceiver.subscribeObserver(this)\n    }\n\n\n    override fun onNetworkChanged(networkStateObj: NewNetworkStateObj) {\n        println(networkStateObj.state.name)\n    }\n\n ```\nAnd that's it. \n\nDon't forget to register and unregister your receiver in the activity onResume/onStop.\n\n## Develop\n\nAny contributions for this repository is blessed, just make sure to:\n* Design in DI style with Dagger 2.1\n* Write your code in Kotlin\n* Seperate views from controllers and modules\n* Stick to generics\n* Work with the Observer design pattern\n* Do not use reflections\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosfunapps%2Fandroid-lib-broadcast-receiver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fosfunapps%2Fandroid-lib-broadcast-receiver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosfunapps%2Fandroid-lib-broadcast-receiver/lists"}