Skip to content
This repository was archived by the owner on Jul 25, 2019. It is now read-only.
This repository was archived by the owner on Jul 25, 2019. It is now read-only.

JobService is not running #36

@mallik482

Description

@mallik482

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 jobParamsMap = new LinkedList();
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions