Skip to content

Commit fef39fa

Browse files
committed
setExpedited for sync worker and display notification immediately
1 parent c6181a5 commit fef39fa

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

app/src/main/java/com/orgzly/android/sync/SyncRunner.kt

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ object SyncRunner {
3131
val workManager = WorkManager.getInstance(App.getAppContext())
3232

3333
val syncWorker = OneTimeWorkRequestBuilder<SyncWorker>()
34+
.setExpedited(OutOfQuotaPolicy.RUN_AS_NON_EXPEDITED_WORK_REQUEST)
3435
.setInputData(workDataOf(AUTO_SYNC_DATA to autoSync))
3536
.build()
3637

app/src/main/java/com/orgzly/android/ui/notifications/SyncNotifications.kt

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ object SyncNotifications {
3838

3939
val builder = NotificationCompat.Builder(context, NotificationChannels.SYNC_PROGRESS)
4040
.setOngoing(true)
41+
.setForegroundServiceBehavior(NotificationCompat.FOREGROUND_SERVICE_IMMEDIATE)
4142
.setSmallIcon(R.drawable.ic_sync)
4243
.setContentTitle(context.getString(R.string.syncing_in_progress))
4344
.setColor(ContextCompat.getColor(context, R.color.notification))

0 commit comments

Comments
 (0)