question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Specify Constraints for running background task

See original GitHub issue

The job scheduler allows you to specify a few constraints based on which the task would be run such as network connectivity status, whether the device is charging or not ,etc. Is there a way to specify that here?

Your Environment

  • Plugin version: 2.4.3
  • Platform: Android
  • OS version: 8.0
  • Device manufacturer / model: N.A.
  • React Native version (react-native -v): 0.55.4
  • Plugin config : N.A.

Expected Behavior

I would like to be able to specify a few constraints for running the background task periodically,

Actual Behavior

Not sure how it is currently done and would like to know how it can be done.

Context

I am trying to start a background sync every 2 hours but would like the task to only be started if the user is connected to the internet.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

4reactions
christocracycommented, Oct 31, 2018

Exactly

3reactions
christocracycommented, Jan 8, 2019

I didn’t close it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Support your app with background tasks - UWP applications
Background task resource constraints ... Background tasks are lightweight. Keeping background execution to a minimum ensures the best user ...
Read more >
Define work requests | Android Developers
The WorkRequest object contains all of the information needed by WorkManager to schedule and run your work. It includes constraints which must be...
Read more >
How to run background tasks in Flutter using WorkManager
Some Constraints​​ If you set durations under 15 minutes it will be automatically overwritten by Android. Sometimes background tasks can even run ......
Read more >
WorkManager in Android: Enqueue and execute background ...
Like JobScheduler, but better, the WorkManager API makes it easy to specify deferrable, asynchronous tasks and indicate when they should run.
Read more >
Creating battery friendly background tasks on Android
With WorkManager, you might also choose to run tasks under certain constraints. For example, you might want a particular task to run when...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found