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.

daily job not working

See original GitHub issue

I use daily job scheduler just like the sample in faq page

'class DailyJobSchedule : DailyJob() {
@RequiresApi(Build.VERSION_CODES.O)
override fun onRunDailyJob(params: Params): DailyJobResult {
    callDb(Room.databaseBuilder(context, LogsDataBase::class.java, DATA_BASE_NAME).build()) {
        it.observerElementDao().insertOrUpdate(Log(Date().time,"onRunDailyJob=${sdf.format(Date())}"))
    }

    return DailyJob.DailyJobResult.SUCCESS
}

companion object {
    val TAG = "MyDailyJob"

    fun schedule() {
        DailyJob.schedule(
                JobRequest.Builder(TAG)
                        .setRequiresDeviceIdle(true)
                        .setRequiredNetworkType(JobRequest.NetworkType.CONNECTED)
                , TimeUnit.HOURS.toMillis(1), TimeUnit.HOURS.toMillis(6)
        )

    }
   }
   }

` but it does not run at all just when in next day I pick up the phone job called. the phone is asus_z017d android8 API 26 I know about doze mode I don’t think that’s the problem because in doze mode jobs starts with a delay but they start right?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

2reactions
vkhirani93commented, Jul 13, 2018

@vRallev I have the exact same issue. I have scheduled multiple daily jobs using different job tags. These jobs will run and make a network call to fetch some data. Now there is a weird behavior in this case.

  1. These jobs run perfectly when the app is in foreground but fails to make a network call when in background or killed state.

  2. Now these failed daily jobs are accumulated and are fired when I launch my app.

Just to give a brief that I too have enforced network requirements.

**Also tried removing network requirements but no success at all. Works fine when the app is in foreground but fails if in background or killed state.

0reactions
vRallevcommented, Jun 23, 2018

Closing because of inactivity.

Read more comments on GitHub >

github_iconTop Results From Across the Web

cron.daily jobs not running - Ask Ubuntu
There are two possible suspects that usually cause cron jobs not being able to run. The first is permissions problems, that is a...
Read more >
I put a cronjob in /etc/cron.{hourly,daily,weekly,monthly} and it ...
I install cron job in /etc/cron.d/ but it does not work. Why is my cron job is not working, and how do I...
Read more >
Why is my cron.daily script not running? - Pete Freitag
Cron scripts do not have all the same environment variables that you have when you are logged in to a shell, so the...
Read more >
cron.daily not running automatically - Unix Stack Exchange
All jobs within /etc/cron. daily are not running automatically. I'm on Debian 10. All permissions and all file names are correct (filenames ...
Read more >
The jobs in cron.daily are not executed by anacron or run-parts
Issue. We have a cron jobs in /etc/cron.daily which are expected to be executed once per day. The jobs in /etc/cron.daily didn't run...
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