use of com.evernote.android.job.JobManager in project PhoneProfilesPlus by henrichg.
the class AboutApplicationJob method _scheduleJob.
private static void _scheduleJob() /*final Context context*/
{
JobManager jobManager = null;
try {
jobManager = JobManager.instance();
} catch (Exception ignored) {
}
if (jobManager != null) {
final JobRequest.Builder jobBuilder;
int requestsForTagSize = jobManager.getAllJobRequestsForTag(JOB_TAG).size();
PPApplication.logE("AboutApplicationJob.scheduleJob", "requestsForTagSize=" + requestsForTagSize);
if (requestsForTagSize == 0) {
jobBuilder = new JobRequest.Builder(JOB_TAG);
// each 24 hours
jobBuilder.setPeriodic(TimeUnit.DAYS.toMillis(1));
} else
return;
PPApplication.logE("AboutApplicationJob.scheduleJob", "build and schedule");
try {
jobBuilder.setUpdateCurrent(// don't update current, it would cancel this currently running job
false).build().scheduleAsync();
} catch (Exception ignored) {
}
}
}
use of com.evernote.android.job.JobManager in project PhoneProfiles by henrichg.
the class AboutApplicationJob method _scheduleJob.
private static void _scheduleJob() /*final Context context*/
{
JobManager jobManager = null;
try {
jobManager = JobManager.instance();
} catch (Exception ignored) {
}
if (jobManager != null) {
final JobRequest.Builder jobBuilder;
int requestsForTagSize = jobManager.getAllJobRequestsForTag(JOB_TAG).size();
PPApplication.logE("AboutApplicationJob.scheduleJob", "requestsForTagSize=" + requestsForTagSize);
if (requestsForTagSize == 0) {
jobBuilder = new JobRequest.Builder(JOB_TAG);
// each 24 hours
jobBuilder.setPeriodic(TimeUnit.DAYS.toMillis(1));
} else
return;
PPApplication.logE("AboutApplicationJob.scheduleJob", "build and schedule");
try {
jobBuilder.setUpdateCurrent(// don't update current, it would cancel this currently running job
false).build().scheduleAsync();
} catch (Exception ignored) {
}
}
}
Aggregations