codelab-android-workmanager icon indicating copy to clipboard operation
codelab-android-workmanager copied to clipboard

Step 9. Show final output - Button not showing

Open markov1100 opened this issue 3 years ago • 2 comments

It appears as if the value that is used for the condition which sets the "SEE FILE" button visibility is null.

I've run the final code provided and the result is that this button cannot be seen. Its visibility is never set to visible because the condition is never met.

issue

markov1100 avatar Mar 21 '22 22:03 markov1100

If you are targeting Q then you will be getting a permission error (I didn't use the demo code so my lines are different). This is why the URI is empty

E/MediaStore: Failed to insert image
    java.lang.SecurityException: Permission Denial: writing com.android.providers.media.MediaProvider uri content://media/external/images/media from pid=11999, uid=10086 requires android.permission.WRITE_EXTERNAL_STORAGE, or grantUriPermission()
        at android.os.Parcel.createException(Parcel.java:1950)
        at android.os.Parcel.readException(Parcel.java:1918)
        at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183)
        at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135)
        at android.content.ContentProviderProxy.insert(ContentProviderNative.java:476)
        at android.content.ContentResolver.insert(ContentResolver.java:1587)
        at android.provider.MediaStore$Images$Media.insertImage(MediaStore.java:982)
        at com.example.learning.workmanager.blur.workers.SaveImageToFileWorker.doWork(BlurWorkers.kt:107)
        at androidx.work.Worker$1.run(Worker.java:86)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)
E/BlurWorkers: Writing to MediaStore failed

HoinzeyBear avatar Jun 14 '22 15:06 HoinzeyBear

If you are targeting Q then you will be getting a permission error (I didn't use the demo code so my lines are different). This is why the URI is empty

that's right! and the solution is only to make runtime permission about WRITE_EXTERNAL_STORAGE

Kakaranara avatar Nov 10 '22 03:11 Kakaranara