{
	"id": "dfa73a89-ad26-48fb-b139-ccc456e74a44",
	"created_at": "2026-04-06T03:37:55.769869Z",
	"updated_at": "2026-04-10T03:20:35.66044Z",
	"deleted_at": null,
	"sha1_hash": "a7c4406b26083023e42b46d21f70aef7ee256e71",
	"title": "Task scheduling",
	"llm_title": "",
	"authors": "",
	"file_creation_date": "0001-01-01T00:00:00Z",
	"file_modification_date": "0001-01-01T00:00:00Z",
	"file_size": 115116,
	"plain_text": "Task scheduling\r\nArchived: 2026-04-06 02:59:22 UTC\r\nWhen you want to execute tasks that will continue to run even if the app leaves the visible state, we recommend\r\nusing the Jetpack library WorkManager. WorkManager features a robust scheduling mechanism that lets tasks\r\npersist across app restarts and device reboots.\r\nTypes of work\r\nWorkManager handles three types of work:\r\nImmediate: Tasks that must begin immediately and complete soon. May be expedited.\r\nLong Running: Tasks which might run for longer, potentially longer than 10 minutes.\r\nDeferrable: Scheduled tasks that start at a later time and can run periodically.\r\nFigure 1 outlines how the different types of tasks relate to one another.\r\nFigure 1: Types of work.\r\nSimilarly, the following table outlines the various types of work.\r\nType Periodicity How to access\r\nImmediate One time\r\nOneTimeWorkRequest and Worker . For expedited work, call set\r\nExpedited() on your OneTimeWorkRequest.\r\nLong\r\nRunning\r\nOne time or\r\nperiodic\r\nAny WorkRequest or Worker . Call setForeground() in the Worker to\r\nhandle the notification.\r\nhttps://developer.android.com/topic/libraries/architecture/workmanager\r\nPage 1 of 5\n\nType Periodicity How to access\r\nDeferrable\r\nOne time or\r\nperiodic\r\nPeriodicWorkRequest and Worker .\r\nFor more information regarding how to set up WorkManager, see the Defining your WorkRequests guide.\r\nWorkManager Features\r\nIn addition to providing a simpler and more consistent API, WorkManager has a number of other key benefits:\r\nWork constraints\r\nDeclaratively define the optimal conditions for your work to run using work constraints. For example, run only\r\nwhen the device is on an unmetered network, when the device is idle, or when it has sufficient battery.\r\nRobust scheduling\r\nWorkManager allows you to schedule work to run one-time or repeatedly using flexible scheduling windows.\r\nWork can be tagged and named as well, allowing you to schedule unique, replaceable work and monitor or cancel\r\ngroups of work together.\r\nScheduled work is stored in an internally managed SQLite database and WorkManager takes care of ensuring that\r\nthis work persists and is rescheduled across device reboots.\r\nIn addition, WorkManager adheres to power-saving features and best practices like Doze mode, so you don't have\r\nto worry about it.\r\nExpedited work\r\nYou can use WorkManager to schedule immediate work for execution in the background. You should use\r\nExpedited work for tasks that are important to the user and which complete within a few minutes.\r\nFlexible retry policy\r\nSometimes work fails. WorkManager offers flexible retry policies, including a configurable exponential backoff\r\npolicy.\r\nWork chaining\r\nFor complex related work, chain individual work tasks together using an intuitive interface that allows you to\r\ncontrol which pieces run sequentially and which run in parallel.\r\nval continuation = WorkManager.getInstance(context)\r\n .beginUniqueWork(\r\n Constants.IMAGE_MANIPULATION_WORK_NAME,\r\nhttps://developer.android.com/topic/libraries/architecture/workmanager\r\nPage 2 of 5\n\nExistingWorkPolicy.REPLACE,\r\n OneTimeWorkRequest.from(CleanupWorker::class.java)\r\n ).then(OneTimeWorkRequest.from(WaterColorFilterWorker::class.java))\r\n .then(OneTimeWorkRequest.from(GrayScaleFilterWorker::class.java))\r\n .then(OneTimeWorkRequest.from(BlurEffectFilterWorker::class.java))\r\n .then(\r\n if (save) {\r\n workRequest\u003cSaveImageToGalleryWorker\u003e(tag = Constants.TAG_OUTPUT)\r\n } else /* upload */ {\r\n workRequest\u003cUploadWorker\u003e(tag = Constants.TAG_OUTPUT)\r\n }\r\n )\r\nWorkManager.getInstance(...)\r\n.beginWith(Arrays.asList(workA, workB))\r\n.then(workC)\r\n.enqueue();\r\nFor each work task, you can define input and output data for that work. When chaining work together,\r\nWorkManager automatically passes output data from one work task to the next.\r\nBuilt-In threading interoperability\r\nWorkManager integrates seamlessly with Coroutines and RxJava and provides the flexibility to plug in your own\r\nasynchronous APIs.\r\nUse WorkManager for reliable work\r\nWorkManager is intended for work that is required to run reliably even if the user navigates off a screen, the app\r\nexits, or the device restarts. For example:\r\nSending logs or analytics to backend services.\r\nPeriodically syncing application data with a server.\r\nWorkManager is not intended for in-process background work that can safely be terminated if the app process\r\ngoes away. It is also not a general solution for all work that requires immediate execution. Please review the\r\nbackground processing guide to see which solution meets your needs.\r\nRelationship to other APIs\r\nThis table shows how WorkManager relates to similar APIs. This information can help you choose the right API\r\nfor your app's requirements.\r\nhttps://developer.android.com/topic/libraries/architecture/workmanager\r\nPage 3 of 5\n\nAPI Recommended for Relationship to WorkManager\r\nCoroutines\r\nAll asynchronous work\r\nthat doesn't need to persist\r\nif the app leaves the\r\nvisible state.\r\nCoroutines are the standard means of leaving the main\r\nthread in Kotlin. However, they stop as soon as the app\r\ncloses. For work that should persist even after the app\r\ncloses, use WorkManager.\r\nAlarmManager Alarms only.\r\nUnlike WorkManager's regular workers, AlarmManager's\r\nexact alarms wake a device from Doze mode. It is therefore\r\nnot efficient in terms of power and resource management.\r\nOnly use it for precise alarms or notifications such as\r\ncalendar events, not for recurring background work.\r\nReplace deprecated APIs\r\nThe WorkManager API is the recommended replacement for previous Android background scheduling APIs,\r\nincluding FirebaseJobDispatcher and GcmNetworkManager .\r\nGet started\r\nCheck out the Getting started guide to start using WorkManager in your app.\r\nAdditional resources\r\nThe following sections provide some additional resources.\r\nVideos\r\nWorkmanager - MAD Skills, video series\r\nWorking with WorkManager, from the 2018 Android Dev Summit\r\nWorkManager: Beyond the basics, from the 2019 Android Dev Summit\r\nBlogs\r\nIntroducing WorkManager\r\nSamples\r\nNow in Android App\r\nLearn how this app was designed and built in the design case study, architecture learning journey and\r\nmodularization learning journey. This is the repository for the Now in Android app. It is a work in progress 🚧.\r\nNow in Android is a fully functional\r\nhttps://developer.android.com/topic/libraries/architecture/workmanager\r\nPage 4 of 5\n\nSource: https://developer.android.com/topic/libraries/architecture/workmanager\r\nhttps://developer.android.com/topic/libraries/architecture/workmanager\r\nPage 5 of 5",
	"extraction_quality": 1,
	"language": "EN",
	"sources": [
		"MITRE"
	],
	"references": [
		"https://developer.android.com/topic/libraries/architecture/workmanager"
	],
	"report_names": [
		"workmanager"
	],
	"threat_actors": [],
	"ts_created_at": 1775446675,
	"ts_updated_at": 1775791235,
	"ts_creation_date": 0,
	"ts_modification_date": 0,
	"files": {
		"pdf": "https://archive.orkl.eu/a7c4406b26083023e42b46d21f70aef7ee256e71.pdf",
		"text": "https://archive.orkl.eu/a7c4406b26083023e42b46d21f70aef7ee256e71.txt",
		"img": "https://archive.orkl.eu/a7c4406b26083023e42b46d21f70aef7ee256e71.jpg"
	}
}