Known Direct Subclasses |
This class is deprecated.
As of November 1, 2020, GCMNetworkManager client libraries are no longer supported.
GCMNetworkManager API calls no longer work on devices running Android M and later once your
app targets future Android versions ( > Android 10).
Migrate to Jetpack WorkManager for your background
scheduling needs.
Encapsulates the parameters of a task that you will schedule on the GcmNetworkManager
.
Construct instances of either PeriodicTask
or
OneoffTask
with
the desired parameters/behaviour and schedule them using
schedule(Task)
.
Nested Class Summary
class | Task.Builder | This class is deprecated. As of November 1,
2020, GCMNetworkManager client libraries are no longer supported. GCMNetworkManager
API calls no longer work on devices running Android M and later once your app targets
future Android versions ( > Android 10). Migrate to Jetpack WorkManager for your background scheduling needs. |
Constant Summary
int | EXTRAS_LIMIT_BYTES | The maximum size allowed for extras bundle in bytes. |
int | NETWORK_STATE_ANY | Specify using
setRequiredNetwork(int) that your task will execute regardless of
whether a network is available. |
int | NETWORK_STATE_CONNECTED | Specify using
setRequiredNetwork(int) that your task will only execute if some
sort of data connection is available - either metered or unmetered. |
int | NETWORK_STATE_UNMETERED | Specify using
setRequiredNetwork(int) that your task will only execute if there is an
unmetered network connection available. |
long | UNINITIALIZED |
Inherited Constant Summary
Public Method Summary
int | |
Bundle | |
int |
getRequiredNetwork()
If the specified network is unavailable, your task will not be
run until it is.
|
boolean |
getRequiresCharging()
If the device is not charging and this is set to true, your task will
not be run until it is.
|
String | |
String |
getTag()
|
boolean | |
boolean | |
void |
writeToParcel(Parcel parcel, int
i)
|
Inherited Method Summary
Constants
public static final int EXTRAS_LIMIT_BYTES
The maximum size allowed for extras bundle in bytes.
public static final int NETWORK_STATE_ANY
Specify using
setRequiredNetwork(int)
that your task will execute regardless of
whether a network is available.
public static final int NETWORK_STATE_CONNECTED
Specify using
setRequiredNetwork(int)
that your task will only execute if some sort
of data connection is available - either metered or unmetered. This is the
default.
public static final int NETWORK_STATE_UNMETERED
Specify using
setRequiredNetwork(int)
that your task will only execute if there is an
unmetered network connection available.
protected static final long UNINITIALIZED
Public Methods
public int describeContents ()
public Bundle getExtras ()
Returns
- The extra parameters for the task set by the client.
public int getRequiredNetwork ()
If the specified network is unavailable, your task will not be run until it is.
Returns
- The network type that this task requires in order to run. See the NETWORK_TYPE_* flavours for an explanation of what this value can be.
public boolean getRequiresCharging ()
If the device is not charging and this is set to true, your task will not be run until it is.
Returns
- Whether or not this task depends on the device being connected to power in order to execute.
public String getServiceName ()
Returns
- The
GcmTaskService
component that this task will execute on.
public String getTag ()
Returns
- The String identifier for this task, that is returned to
onRunTask(com.google.android.gms.gcm.TaskParams)
when this task executes.
public boolean isPersisted ()
Returns
- Whether this task will be persisted across devices restarts or Google Play Services crashes.
public boolean isUpdateCurrent ()
Returns
- Whether or not this task will update a pre-existing task in the scheduler queue.