com.google.android.gms.gcm.PeriodicTask

Here are the examples of the java api class com.google.android.gms.gcm.PeriodicTask taken from open source projects.

1. JobProxyGcm#plantPeriodic()

Project: android-job
Source File: JobProxyGcm.java
View license
@Override
public void plantPeriodic(JobRequest request) {
    PeriodicTask task = new PeriodicTask.Builder().setTag(createTag(request)).setService(PlatformGcmService.class).setUpdateCurrent(true).setPeriod(request.getIntervalMs() / 1_000).setRequiredNetwork(convertNetworkType(request.requiredNetworkType())).setPersisted(request.isPersisted()).setRequiresCharging(request.requiresCharging()).build();
    mGcmNetworkManager.schedule(task);
    CAT.d("Scheduled PeriodicTask, %s, interval %s", request, JobUtil.timeToString(request.getIntervalMs()));
}

2. NetworkSchedulerFragment#addPeriodic()

Project: gcm
Source File: NetworkSchedulerFragment.java
View license
private void addPeriodic(long periodSecs, long flexSecs, int connectivity, boolean charging, boolean persistence) {
    if (flexSecs > periodSecs) {
        Toast.makeText(getActivity(), getString(R.string.scheduler_error_flex), Toast.LENGTH_SHORT).show();
        return;
    }
    String tag = Long.toString(SystemClock.currentThreadTimeMillis());
    final TaskTracker taskTracker = TaskTracker.createPeriodic(tag, periodSecs, flexSecs);
    PeriodicTask periodic = new PeriodicTask.Builder().setService(TaskSchedulerService.class).setPeriod(periodSecs).setFlex(flexSecs).setTag(tag).setRequiredNetwork(connectivity).setRequiresCharging(charging).setPersisted(persistence).build();
    mScheduler.schedule(periodic);
    mTasks.updateTask(taskTracker);
}