PhotoEditor SDK supports exporting photos in the background using
WorkManager. Background export requires the
backend:headless module. Refer to our documentation on how to include the module in your project.
For the sake of this example, we load a photo from the resources into the photo editor.
PhotoEditorSaveSettings to set the
outputMode to only export the
SettingsList (instead of the photo). This
SettingsList will be used later to export the photo in the background.
The result from the editor is received in the
EditorSDKResult wraps around the intent and provides a convenient API to check the result. Here, we obtain the
EditorSDKResult.settingsList and create a
WorkRequest using the
DocumentRenderWorker.createWorker() method. This
WorkRequest is then enqueued in the
WorkManager for background processing.
Note the usage of the
use() method on the
SettingsList. It automatically releases the
SettingsList after executing the block so we don't have to release it manually.