Hello guy's here i m going to update some short important points about §  Work Manager will help to understand easily 
§ To perform single and multiple task with enqueue process manage using Work Requests
§ Now Work Manager with Android Architecture Component and Its comes with Android Jetpack to handle like background work thread, and its guaranteed to execute to take care of perform Logic within it. It will do your background task as it can.
      What benefits to be use of Work Manager
Its Support for asynchronous one and periodic
tasks
Its Support for constraints like network
conditions, storage space, and charging status 
Its can Chaining of complex work requests, with  running work in parallel    
From one work request Get Output and Its used as
input for the next
Compatibility back to API level supports Android 4.0+ (API 14+).
Works with or without Google Play services
Follows system health best practices
       Live Data support to
easily display work request state in UI
When need to be use Work Manager
The Work Manager library is a good
choice for perform long running tasks that are need to complete, even if the
user navigates away from a particular Applications screen
Like below some tasks for good use of
Work Manager
- Applying filtration  to images and save image
 - On Particular Interval time  syncing local data with the network Data
 - Uploading Logs, Data
 
What you will  need to handle in Work Manager library 
- Worker -> You need to get subclass, to perform the task, that will run in the background.
 
- Work Request -> Its represents the request of the task that will run. Need to set the task through the Worker subclass. Also You can specify constraints Like, only run the task if the device has Internet connectivity. There are two main types of work requests:
 
- One Time Work Request -> which can be executes the task just one time, 
 
- Periodic Work Request -> which can be executes your task periodically.
 
                                         This Periodic Work Request can be customized 
                                          as per your needed interval.
- Work Status -> Whenever you want to know the status of your
 
                                 you
can ask its to the Work Manager for it. 
                                So It will  provide
a Live Data object containing 
                                one or more Work Status objects.
What you will  learn from
Work Manager library 
- Passing data Input and output
     parameters
 - Multiple works request Chaining
     work
 - Unique work
 - Displaying work status in the
     UI
 - Adding Work Manager into your
     project
 - Scheduling a simple Single task
     execution 
 - Cancelling work by Id
 
No comments:
Post a Comment
Comments