问题
I've looked around and the consensus is it's fixed on Alpha-07, but I'm seeing it in 08 on a 7.0 AND 8.0 device. I have network constraints so there is a possibility that given a long period of no network I could schedule more than 100 work items. I'm a little confused about how batching plays into this. Are we saying WorkManager can only schedule 100 items before it crashes or is there still a batching bug? Thanks
Code that adds to WM:
Constraints constraints = new Constraints.Builder()
.setRequiredNetworkType(NetworkType.CONNECTED)
.build();
Data inputData = new Data.Builder()
.putString(UploadWorker.DATA, data)
.build();
OneTimeWorkRequest uploadWork = new OneTimeWorkRequest.Builder(UploadWorker.class)
.setConstraints(constraints)
.setInputData(inputData)
.setBackoffCriteria(BackoffPolicy.EXPONENTIAL, BACK_OFF_TIME_DELAY_SECONDS, TimeUnit.SECONDS)
.addTag(TAG)
.build();
WorkManager workManager = WorkManager.getInstance();
workManager.enqueue(uploadWork);
回答1:
There's a new version of the WorkManager library (version alpha09) that should solves this issue once for all. As reported in the release notes:
Added another fix that was needed for the "100 jobs" error. b/115560696
A good option to see how the WorkManager library is evolving is to keep an eye on its issue tracker.
来源:https://stackoverflow.com/questions/52286698/alpha-08-apps-may-not-schedule-more-than-100-distinct-jobs