我正在使用 NetworkType.CONNECTED 约束创建 OneTimeWorkRequest,但即使设备连接到互联网,请求仍处于 ENQUEUED 状态
Constraints constraints = new Constraints.Builder().setRequiredNetworkType(NetworkType.CONNECTED).build();
OneTimeWorkRequest request = new OneTimeWorkRequest.Builder(SyncWorker.class)
.setConstraints(constraints)
.build();
WorkContinuation continuation = mWorkManager.beginUniqueWork("work",
ExistingWorkPolicy.KEEP, request);
continuation.enqueue();