Skip to content

Applying filters to images and saving the image with WorkManager

License

Notifications You must be signed in to change notification settings

ersiver/sample-workmanager-images

Repository files navigation

sample-workmanager-images

The app was built following Google Developers Codelabs. The app blurs photos and images and saves the result to a file with use of WorkManager concepts. The app demonstrates following features:

  • Scheduling a OneOffWorkRequest

  • Input and Output parameters

  • Chaining work together WorkRequests

  • Naming Unique WorkRequest chains

  • Tagging WorkRequests

  • Displaying WorkInfo in the UI

  • Cancelling WorkRequests

  • Adding constraints to a WorkRequest

  • Custom configuration

  • Publishing progress from Worker

  • Test Workers

  • View Binding to interact with views in place of findViewById.

CheatSheet

What is the WorkManager:

  • It is a backwards compatible, flexible and simple library for deferrable background work.

  • It is the recommended task scheduler on Android for deferrable work, with a guarantee to be executed.

  • It is part of Android Jetpack and an Architecture Component for background work that needs a combination of opportunistic and guaranteed execution.Opportunistic execution means that WorkManager will do the background work as soon as it can. Guaranteed execution means that WorkManager will take care of the logic to start your work under a variety of situations, even if you navigate away from your app.

  • WorkManager sits on top of a few APIs such as JobScheduler and AlarmManager. WorkManager picks the right APIs to use, based on conditions like the user's device API level.

WorkManager benefits:

  • Support for both asynchronous one-off and periodic tasks

  • Support for constraints such as network conditions, storage space, and charging status

  • Chaining of complex work requests, including running work in parallel

  • Output from one work request used as input for the next

  • Handles API level compatibility back to API level 14

  • Works with or without Google Play services

  • Follows system health best practices

  • LiveData support to easily display work request state in UI

When to use WorkManager:

  • The WorkManager library is a good choice for tasks that are useful to complete, even if the user navigates away from the particular screen or your app.

  • Some examples of tasks that are a good use of WorkManager:
    a) Uploading logs
    b) Applying filters to images and saving the image
    c) Periodically syncing local data with the network

Licence

Copyright 2020 Google LLC.

About

Applying filters to images and saving the image with WorkManager

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages