Test Job with Execution Window.
See original GitHub issueHi
new JobRequest.Builder(SyncJob.TAG)
.setExtras(extras)
.setExecutionWindow(startMs, endMs)
.setRequiredNetworkType(JobRequest.NetworkType.ANY)
.setUpdateCurrent(true)
.setPersisted(true)
.setRequirementsEnforced(true)
.build()
.schedule();
this is a builder for a job, and execution window is between 1AM - 6AM as it was given in the example(it fits well, my needs).
-
Question is , how can I test this? If I change phone’s clock, this does not help, because execution windows is too wide. Also, I noticed that this job runs after the 6AM, for example, it happened to run at 8PM. I looked in library’s test files, but there was written expected behavior of job, not the action itself. It may not run in the given execution time window.
-
in
onRunJob
, I do async job and returnRESCHEDULE
every time ,to ensure that service will run, because it failed to run, several nights.
Please response, maybe I’m missing something.
Thanks in advance.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6
Top Results From Across the Web
Window Tester Jobs, Employment | Indeed.com
1250 Window Tester jobs available on Indeed.com. Apply to Quality Assurance Tester, Tester, Senior Software Engineer and more!
Read more >Test Programs for the Windows Agent
There are various ways of starting Windows jobs or programs. ... The test programs do not have an actual function. their execution can...
Read more >Tips and Tricks for Testing Salesforce - Topcoder
Go to “Developer Console” and click “Query Editor” tab · Click on “Debug” tab · Select the ”Open Execute Anonymous Window” option or...
Read more >How to properly test a Flink window function? - Stack Overflow
Get the StreamExecutionEnvironment; Create objects and add to the invironment; Do a keyBy; add a Session Window; execute an aggregate function.
Read more >Abort Apex test class execution using ApexTestQueueItems
"To abort a class that is in the Apex job queue, perform an update operation on the ApexTestQueueItem object and set its Status...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t like the design of the
JobScheduler
. The problem is that you need to launch a background thread on your own and manage its state. You end up with many callbacks, because you need to post the result to the service again.The library is doing all of this for you. However, if you run an async operation then the worker thread of the library finishes and doesn’t know that there’s still an operation going on.
Could be a problem, because when the library thinks it’s done, then the service is killed and your app is more likely stopped by the system.
If you follow the sample, then it should work. It’s possible that devices adjust the execution window in order to save battery. Unfortunately, there isn’t anything I could do.
You can start a job manually if the job schedule is used (Android 5+), see here.
Can you show your
onRunJob()
method? If you follow my sample, then you shouldn’t returnRESCHEDULE
. That explains why you see that your job runs at 8 PM.