android / user-interface-samples

Multiple samples showing the best practices in the user interface on Android.
Apache License 2.0
4.38k stars 1.64k forks source link

AppWidget ImageGlanceWidget Permission Issue on Restart #464

Open nrotonda opened 5 months ago

nrotonda commented 5 months ago

I just ran your AppWidget app and added the Random Images widget to the home screen. Then, restarted the device and received the error below. I am running the app on a device using API 34. Looks like the permissions are getting revoked, or the image is no longer there and the widget doesn't know that. Any way to check for the read permission in the widget and then force another Worker to run? Can't surround the composables with a try catch to catch this error.

java.lang.SecurityException: Permission Denial: reading androidx.core.content.FileProvider uri content://com.example.android.appwidget.fileprovider/widget_images/90a6ee10a2cee258dc6137b3cd810a1b0b40be3b5060912d23dd20ce57a01e70.1 from pid=1013, uid=10166 requires the provider be exported, or grantUriPermission()

image