Skip to content

Commit

Permalink
Require network for background refresh on android
Browse files Browse the repository at this point in the history
  • Loading branch information
steviek committed Jan 23, 2025
1 parent 862e344 commit f1e988a
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.work.CoroutineWorker
import androidx.work.Data
import androidx.work.ExistingPeriodicWorkPolicy.KEEP
import androidx.work.ExistingWorkPolicy
import androidx.work.NetworkType.CONNECTED
import androidx.work.OneTimeWorkRequestBuilder
import androidx.work.PeriodicWorkRequestBuilder
import androidx.work.WorkManager
Expand Down Expand Up @@ -77,6 +78,7 @@ class WidgetRefreshWorker(
.setConstraints(
Constraints.Builder()
.setRequiresBatteryNotLow(true)
.setRequiredNetworkType(CONNECTED)
.build()
)
.setInputData(Data.Builder().putBoolean(IS_BACKGROUND, true).build())
Expand Down

0 comments on commit f1e988a

Please sign in to comment.