'Android WorkManager Network Constraint For Both Wifi and Data (Cellular)
I am learning WorkManager and wondering if following the correct way of setting network constraint for both Wifi and data (cellular):
val constraints = Constraints.Builder().run {
setRequiredNetworkType(NetworkType.UNMETERED) //Wifi
setRequiredNetworkType(NetworkType.METERED) //data
build()
}
Solution 1:[1]
That's exactly the use case for the NetworkType.CONNECTED type:
Any working network connection is required for this work.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | ianhanniballake |
