This issue respects the following points:
Describe the bug
Description
In SingleNoteWidget.kt, it performs synchronous Room database queries on the main thread.
This happens inside the onReceive() → updateAppWidget() → getSingleNoteWidgetData() call chain.
Where the issue occurs
onReceive() runs on the main/UI thread.
onReceive() calls updateAppWidget, and inside updateAppWidget it calls getSingleNoteWidgetData. getSingleNoteWidgetData() is a blocking Room query, and since it is executed directly in onReceive(), it blocks the main thread.
What Android recommends
According to official guidelines:
Disk I/O and DB queries must not run on the main thread.
BroadcastReceiver should do only lightweight work.
Heavy work should be moved to a background thread (Executor / Coroutine / WorkManager).
Expected behavior
Move the database read into a background thread.
Notes Android version
4.5.2
Notes server version
4.5.2
Nextcloud Android version
4.5.2
Nextcloud version
4.5.2
Device
Android Emulator
Android Version
Android Version: 13 (API 33)
App Store
Stacktrace
No response
This issue respects the following points:
Describe the bug
Description
In SingleNoteWidget.kt, it performs synchronous Room database queries on the main thread.
This happens inside the onReceive() → updateAppWidget() → getSingleNoteWidgetData() call chain.
Where the issue occurs
onReceive() runs on the main/UI thread.
onReceive() calls updateAppWidget, and inside updateAppWidget it calls getSingleNoteWidgetData. getSingleNoteWidgetData() is a blocking Room query, and since it is executed directly in onReceive(), it blocks the main thread.
What Android recommends
According to official guidelines:
Disk I/O and DB queries must not run on the main thread.
BroadcastReceiver should do only lightweight work.
Heavy work should be moved to a background thread (Executor / Coroutine / WorkManager).
Expected behavior
Move the database read into a background thread.
Notes Android version
4.5.2
Notes server version
4.5.2
Nextcloud Android version
4.5.2
Nextcloud version
4.5.2
Device
Android Emulator
Android Version
Android Version: 13 (API 33)
App Store
Stacktrace
No response