{"id":18764993,"url":"https://github.com/mobiledevpro/android-workmanager-demo","last_synced_at":"2025-09-01T18:31:50.411Z","repository":{"id":44533706,"uuid":"434560335","full_name":"mobiledevpro/Android-WorkManager-Demo","owner":"mobiledevpro","description":"Demo app using WorkManager API. Support Android 6 - 11. Official doc https://developer.android.com/topic/libraries/architecture/workmanager","archived":false,"fork":false,"pushed_at":"2023-11-20T15:47:56.000Z","size":863,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-07T18:51:04.214Z","etag":null,"topics":["android","background-jobs","clean-architecture","kotlin","material-ui","material3","mvvm","mvvm-architecture","rxandroid2","rxjava2","workers","workmanager","workmanager-architecturecomponent","workmanager-example","workmanager-kotlin"],"latest_commit_sha":null,"homepage":"https://mobile-dev.pro","language":"Kotlin","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/mobiledevpro.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"ko_fi":"mobiledevpro"}},"created_at":"2021-12-03T10:45:47.000Z","updated_at":"2023-11-22T17:53:55.000Z","dependencies_parsed_at":"2023-11-20T16:55:32.136Z","dependency_job_id":null,"html_url":"https://github.com/mobiledevpro/Android-WorkManager-Demo","commit_stats":null,"previous_names":["mobiledevpro/android-workmanager-demo"],"tags_count":0,"template":true,"template_full_name":"mobiledevpro/Android-Kotlin-MVVM-Template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mobiledevpro%2FAndroid-WorkManager-Demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mobiledevpro%2FAndroid-WorkManager-Demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mobiledevpro%2FAndroid-WorkManager-Demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mobiledevpro%2FAndroid-WorkManager-Demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mobiledevpro","download_url":"https://codeload.github.com/mobiledevpro/Android-WorkManager-Demo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231705036,"owners_count":18413946,"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","background-jobs","clean-architecture","kotlin","material-ui","material3","mvvm","mvvm-architecture","rxandroid2","rxjava2","workers","workmanager","workmanager-architecturecomponent","workmanager-example","workmanager-kotlin"],"created_at":"2024-11-07T18:32:22.727Z","updated_at":"2024-12-29T05:43:28.144Z","avatar_url":"https://github.com/mobiledevpro.png","language":"Kotlin","readme":"# Android | Jetpack WorkManager | Demo\n\n[![Kotlin Version](https://img.shields.io/badge/kotlin-1.6.10-blue.svg?style=for-the-badge)](http://kotlinlang.org/)\n[![Gradle](https://img.shields.io/badge/gradle-7.2-blue.svg?style=for-the-badge)](https://lv.binarybabel.org/catalog/gradle/latest)\n[![API](https://img.shields.io/badge/API-23%2B-blue.svg?style=for-the-badge)](https://android-arsenal.com/api?level=23)\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg?style=for-the-badge)](http://www.apache.org/licenses/LICENSE-2.0)\n\n[![CodeFactor](https://www.codefactor.io/repository/github/mobiledevpro/android-workmanager-demo/badge)](https://www.codefactor.io/repository/github/mobiledevpro/android-workmanager-demo)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=mobiledevpro_Android-WorkManager-Demo\u0026metric=alert_status)](https://sonarcloud.io/summary/new_code?id=mobiledevpro_Android-WorkManager-Demo)\n\n![GitHub last commit](https://img.shields.io/github/last-commit/mobiledevpro/Android-WorkManager-Demo?color=red\u0026style=for-the-badge)\n\n##\n\n_WorkManager is the recommended solution for persistent work. Work is persistent when it remains scheduled through app restarts and system reboots. Because most background processing is best accomplished through persistent work, WorkManager is the primary recommended API for background processing._ [Read more in official docs](https://developer.android.com/topic/libraries/architecture/workmanager)\n\n##\n\n## 3 Steps to run periodic tasks in the background even the app is closed:\n\n### #1 Init Jetpack WorkManager \n\n```kotlin\nWorkManager.getInstance(applicationContext)\n```\n\n### #2 Setup Worker \n\n```kotlin\nclass PriceAlerterWorker(\n    appContext: Context,\n    params: WorkerParameters,\n    private val interactor: PriceAlerterInteractor\n) : RxWorker(appContext, params) {\n\n    override fun createWork(): Single\u003cResult\u003e =\n        interactor\n            .createDemoAlert()\n            .map { result -\u003e\n                when (result) {\n                    is RxResult.Success -\u003e {\n                        //Do something on success\n                        Result.success()\n                    }\n                    is RxResult.Failure -\u003e {\n                        //Do something on fail\n                        Result.retry()\n                    }\n                }\n            }\n}\n\n```\n\n### #3 Build request and run work\n\n```kotlin\n        PeriodicWorkRequestBuilder\u003cPriceAlerterWorker\u003e(15, TimeUnit.MINUTES)\n            .setConstraints(\n                Constraints.Builder()\n                    .setRequiresBatteryNotLow(true)\n                    .build()\n            )\n            .addTag(WORKER_PRICE_ALERT_TAG)\n            .build()\n            .let { request -\u003e\n                workManager.runUniqueWork(\n                    request,\n                    \"${WORKER_PRICE_ALERT_TAG}_periodic\"\n                )\n            }\n```\n\n\n## More about WorkManager: \n\n### [WorkManager basics (article)](https://medium.com/androiddevelopers/workmanager-basics-beba51e94048)\n\n### [WorkManager custom configuration and WorkerFactory (article)](https://medium.com/androiddevelopers/customizing-workmanager-fundamentals-fdaa17c46dd2)\n\n### [Koin 3 + WorkManager (article)](https://medium.com/koin-developers/whats-next-with-koin-2-2-3-0-releases-6c5464ae5e3d)\n\n## Notes:\n\n+ The minimal interval for periodic tasks is 15 minutes, even if you set 1 min.\n+ Retry with Backoff policy supports the minimum 10 sec and the maximum 5 hours interval (30 sec by\n  default).\n\n## Follow:\n\n\u003ca href=\"https://www.instagram.com/mobiledevpro/\" target=\"_blank\"\u003e\n  \u003cimg src=\"https://s.gravatar.com/avatar/72c649d298a8f0f088fd0850e19b9147?s=400\" width=\"70\" align=\"left\"\u003e\n\u003c/a\u003e\n\n**Dmitri Chernysh**\n\n[![Youtube](https://img.shields.io/badge/-youtube-red?logo=youtube\u0026message=Youtube\u0026style=for-the-badge)](https://www.youtube.com/@mobiledevpro?sub_confirmation=1)\n[![Instagram](https://img.shields.io/badge/-instagram-E4405F?logo=instagram\u0026message=Behind+the+scenes+in+Storiesn\u0026style=for-the-badge\u0026logoColor=white)](https://www.instagram.com/mobiledevpro/)\n[![Twitter](https://img.shields.io/badge/-twitter-1DA1F2?logo=twitter\u0026style=for-the-badge\u0026logoColor=white)](https://twitter.com/mobiledev_pro)\n[![Linkedin](https://img.shields.io/badge/-linkedin-0A66C2?logo=linkedin\u0026style=for-the-badge\u0026logoColor=white)](https://www.linkedin.com/in/dmitriychernysh/)\n\n## License:\n\n   Copyright 2021 Dmitriy Chernysh\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","funding_links":["https://ko-fi.com/mobiledevpro"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmobiledevpro%2Fandroid-workmanager-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmobiledevpro%2Fandroid-workmanager-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmobiledevpro%2Fandroid-workmanager-demo/lists"}