Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Background Work with WorkManager (deprecated code) #33

Open
Youssouf-Bologna opened this issue Mar 26, 2024 · 0 comments · May be fixed by #36
Open

Background Work with WorkManager (deprecated code) #33

Youssouf-Bologna opened this issue Mar 26, 2024 · 0 comments · May be fixed by #36

Comments

@Youssouf-Bologna
Copy link

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-compose-workmanager#10

In which task and step of the codelab can this issue be found?

Describe the problem
Create SaveImageToFileWorker- source code

`package com.example.bluromatic.workers

import ...

/**

  • Saves the image to a permanent file
    */
    private const val TAG = "SaveImageToFileWorker"

class SaveImageToFileWorker(ctx: Context, params: WorkerParameters) : CoroutineWorker(ctx, params) {

...

override suspend fun doWork(): Result {
    ...

    return withContext(Dispatchers.IO) {
        ...
        return@withContext try {
            ...

/*****************************************************************
*** MediaStore.Images.Media.insertImage <- insertImage @deprecated
***************************************************************/
val imageUrl = MediaStore.Images.Media.insertImage(
resolver, bitmap, title, dateFormatter.format(Date())
)
...
} catch (exception: Exception) {
...
}
}
}
}
`
Copie d'écran_20240326_065714

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant