Skip to content

Commit 2c5369a

Browse files
committed
feat: update widget every 15 mins
1 parent 7ce4d37 commit 2c5369a

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

mobile/src/main/java/net/activitywatch/android/widget/CategoryTimeWidgetProvider.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ private const val ACTION_REFRESH = "net.activitywatch.android.widget.ACTION_REFR
1717

1818
/**
1919
* Widget provider for displaying category time stats.
20-
* Updates are handled every 30 minutes via both Android's widget update mechanism
21-
* and WorkManager for reliability. Also supports manual refresh via button click.
20+
* Updates are handled every 15 mins by the work manager and every 30 mins by
21+
* Android's widget update mechanism.
2222
*/
2323
class CategoryTimeWidgetProvider : AppWidgetProvider() {
2424

mobile/src/main/java/net/activitywatch/android/widget/CategoryTimeWidgetWorker.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ private val CATEGORY_ACCENT_COLORS = intArrayOf(
4545
)
4646

4747
/**
48-
* Worker that updates the widget in the background every 30 minutes
48+
* Worker that updates the widget in the background every 15 minutes
4949
*/
5050
class CategoryTimeWidgetWorker(
5151
private val context: Context,
@@ -89,15 +89,15 @@ class CategoryTimeWidgetWorker(
8989
*/
9090
fun schedulePeriodicUpdates(context: Context) {
9191
val workRequest = PeriodicWorkRequestBuilder<CategoryTimeWidgetWorker>(
92-
30, TimeUnit.MINUTES
92+
15, TimeUnit.MINUTES
9393
).build()
9494

9595
WorkManager.getInstance(context).enqueueUniquePeriodicWork(
9696
WORK_NAME,
9797
ExistingPeriodicWorkPolicy.KEEP,
9898
workRequest
9999
)
100-
Log.d(TAG, "Scheduled periodic widget updates every 30 minutes")
100+
Log.d(TAG, "Scheduled periodic widget updates every 15 minutes")
101101
}
102102

103103
/**

0 commit comments

Comments
 (0)