This is a companion discussion topic for the original entry at https://www.raywenderlich.com/9253-jetpack-workmanager-observe-and-constrain
This is a companion discussion topic for the original entry at https://www.raywenderlich.com/9253-jetpack-workmanager-observe-and-constrain
Hi, i’m planning to add work manager to sync some data from the server, is not critical data, so it can wait, i have seen some tutorial in this site, but i have no idea how to test the work manager, unit test, or maybe integration testing, where i can find some material or examples for that topic?
@macsimus Can you please help with this when you get a chance? Thank you - much appreciated! :]
Hi @spaceghost87! Thanks for the question.
There are not many resources out there yet on testing WorkManager. There is a testing dependency you can pull in like this:
androidTestImplementation “android.arch.work:work-testing:1.0.0-alpha01”
You can also try looking up resources on strategies for testing JobScheduler, since testing WorkManager will be similar. We’ll try to put up a screencast in the near future on WorkManager tests. Thanks again!
thanks for the quick reply, i think we are facing the same problem, it’s hard to find anything about this topic, but is not impossible!
i’ll try to post here if i find something useful
Gretting From Chile
i cannot access all video course i am from indonesia, i am using chrome version 71.0.3578.62 and please help me
@syntax Do you still have this issue or is it working now?
Hi @macsimus. I see a problem when using WorkManager. Can you let me know why it happen?
This is the logcat
Fatal Exception: java.lang.IllegalStateException: Apps may not schedule more than 100 distinct jobs
at android.os.Parcel.createException(Parcel.java:1974)
at android.os.Parcel.readException(Parcel.java:1934)
at android.os.Parcel.readException(Parcel.java:1884)
at android.app.job.IJobScheduler$Stub$Proxy.schedule(IJobScheduler.java:184)
at android.app.JobSchedulerImpl.schedule(JobSchedulerImpl.java:44)
at androidx.work.impl.background.systemjob.SystemJobScheduler.scheduleInternal(SystemJobScheduler.java:161)
at androidx.work.impl.background.systemjob.SystemJobScheduler.schedule(SystemJobScheduler.java:128)
at androidx.work.impl.Schedulers.schedule(Schedulers.java:91)
at androidx.work.impl.utils.ForceStopRunnable.run(ForceStopRunnable.java:100)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
Thanks for the question, @vinhntdev. I’ll take a look at the issue you’re seeing soon, hopefully in a day or two, and let you know what I find. At what point in the video do you see this issue? Thanks again.