OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package org.chromium.components.background_task_scheduler; |
| 6 |
| 7 import android.content.Context; |
| 8 |
| 9 /** |
| 10 * The internal representation of a {@link BackgroundTaskScheduler} to make it p
ossible to use |
| 11 * system APIs ({@link android.app.job.JobScheduler} on newer platforms and GCM |
| 12 * ({@link com.google.android.gms.gcm.GcmNetworkManager}) on older platforms. |
| 13 */ |
| 14 interface BackgroundTaskSchedulerDelegate { |
| 15 /** |
| 16 * Schedules a background task. See {@link TaskInfo} for information on what
types of tasks that |
| 17 * can be scheduled. |
| 18 * |
| 19 * @param context the current context. |
| 20 * @param taskInfo the information about the task to be scheduled. |
| 21 * @return true if the schedule operation succeeded, and false otherwise. |
| 22 * @see TaskInfo |
| 23 */ |
| 24 boolean schedule(Context context, TaskInfo taskInfo); |
| 25 |
| 26 /** |
| 27 * Cancels the task specified by the task ID. |
| 28 * |
| 29 * @param context the current context. |
| 30 * @param taskId the ID of the task to cancel. See {@link TaskIds} for a lis
t. |
| 31 */ |
| 32 void cancel(Context context, int taskId); |
| 33 } |
OLD | NEW |