Cannot run job of SimpleJobService

31
July 28, 2019, at 9:20 PM

I've a simple job service class where I've implemented onRunJob method. I am expecting it to run for once and then finish. However onRunJob method of SimpleJobService is never called. Here is my code

class NumberUpdateJobService:SimpleJobService() {
    companion object {
        fun scheduleUpdateJob(context: Context) {
            val jobDispatcher = FirebaseJobDispatcher(GooglePlayDriver(context))
            val job: Job = jobDispatcher.newJobBuilder()
                .setTag("update_job")
                .setService(NumberUpdateJobService::class.java).setConstraints(Constraint.ON_ANY_NETWORK)
                .setTrigger(Trigger.executionWindow(0,15))
                .build()
            jobDispatcher.schedule(job)
        }
    }
    override fun onRunJob(job: JobParameters?): Int {
        //TODO create some random job and
        // sleep thread for 3 seconds
        SystemClock.sleep(3000)
        return JobService.RESULT_SUCCESS
    }
}

I've added the service in Manifest as well. What am I doing wrong? Please help.

READ ALSO
Can't get malloc debug to turn on?

Can't get malloc debug to turn on?

I'm trying to enable malloc debug for my android application, and for the life of me i can't get it working

51
Tabbar in ios at the top of screen

Tabbar in ios at the top of screen

I want to make tabbar at the top of the screen in iOS and want to place 3-4 tabsAndroid is giving functionality by default using Tab bar layout

59
How to add C++ project in Android? [on hold]

How to add C++ project in Android? [on hold]

I want to make a massaging app for androidNetworking part will be coded in c++ and GUI will be in android SDK

58
withColumn syntax using column length, in Java

withColumn syntax using column length, in Java

I'm trying to create a column with the following logic using withColumn function in Spark Java code:

25