JobSchedulerCompat icon indicating copy to clipboard operation
JobSchedulerCompat copied to clipboard

JobService is not running

Open mallik482 opened this issue 9 years ago • 0 comments

I have used this library Its working before. I don't no what I changed suddenly its not working

this my activity private void setUpJobScheduler() { jobScheduler = JobScheduler.getInstance(this);

    JobInfo job = new JobInfo.Builder(0, new ComponentName(this, NotificationJobService.class))
            .setRequiredNetworkType(JobInfo.NETWORK_TYPE_UNMETERED)
            .setRequiresCharging(false)
            .setPeriodic(10000)
            /*.setExtras(extras)*/
            .build();
    System.out.println("======= inside job scheduler");
    jobScheduler.schedule(job);
}

this is my job service

public class NotificationJobService extends JobService implements BroadcastListCallback,TextToSpeech.OnInitListener{ private final LinkedList<JobParameters> jobParamsMap = new LinkedList<JobParameters>(); Cache session; TextToSpeech speech; @Override public boolean onStartJob(JobParameters params) { jobParamsMap.add(params); System.out.println("====== inside job "+session.getNotificationFlag()); if(session.getLogin() && session.getNotificationFlag()) { System.out.println("=========== yes"); NotificationServiceTask task = new NotificationServiceTask(this, session.getUserID(), "received", "", ""); task.execute(); }else{ JobParameters parameters=jobParamsMap.poll(); if (parameters == null) {

        }else {
            jobFinished(parameters, false);
        }
    }
    return false;
}

@Override
public boolean onStopJob(JobParameters params) {
    jobParamsMap.remove(params);
    return false;
}

@Override
public void onBroadcastList(ArrayList<BroadcastRequests> list) {
    JobParameters parameters=jobParamsMap.poll();
    if (parameters == null) {

    }else {
        jobFinished(parameters, true);
    }

    System.out.println("======="+session.getRequestsCount() +"==="+ list.size());
    if(session.getType().equals("Retailer")){
        if(RetailersNavigationActivity.requestsCounter != null)
            RetailersNavigationActivity.requestsCounter.setText(list.size()+"");
    }else{
        if(NavigationActivity.requestsCounter != null)
            NavigationActivity.requestsCounter.setText(list.size()+"");
    }


}

@Override
public void onInit(int status) {
    if(status !=TextToSpeech.ERROR)
        speech.setLanguage(Locale.UK);
}

@Override
public void onCreate() {
    super.onCreate();
    session=new Cache(this);
    speech=new TextToSpeech(getApplicationContext(),this);
}

}

this service is not calling.

My manifest is

Tel me what is the reason

mallik482 avatar Jun 07 '16 19:06 mallik482