Answer the question
In order to leave comments, you need to log in
JobScheduler. Why won't the JobService start?
I'm trying to start JobScheduler, but for some reason my JobService is not even created. The application does not crash, there are no errors, but the service does not start. Please take a look, maybe I missed something?
Code for creating/starting the Scheduler:
JobScheduler jobScheduler = (JobScheduler) appContext.getSystemService(Context.JOB_SCHEDULER_SERVICE);
jobScheduler.schedule(new JobInfo.Builder(1, new ComponentName(appContext, SchedulerService.class))
.setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)
.build());
public class SchedulerService extends JobService {
private static final String LOG_TAG = "SchedulerService";
@Override
public void onCreate() {
Log.d(LOG_TAG, "onCreate");
super.onCreate();
}
@Override
public boolean onStartJob(JobParameters params) {
Log.d(LOG_TAG, "onStartJob");
return true;
}
<service
android:name=".SchedulerService"
android:permission="android.permission.BIND_JOB_SERVICE"/>
Answer the question
In order to leave comments, you need to log in
Here is the madness. The problem was solved by cleaning the project caches (File > Invalidate Caches) and restarting the smartphone.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question