Skeleton for application-specific IntentServices responsible for handling communication from Google Cloud Messaging service. More...
Public Member Functions | |
final void | onHandleIntent (Intent intent) |
Static Public Attributes | |
static final String | TAG = "GCMBaseIntentService" |
Protected Member Functions | |
GCMBaseIntentService () | |
Constructor that does not set a sender id, useful when the sender id is context-specific. More... | |
GCMBaseIntentService (String...senderIds) | |
Constructor used when the sender id(s) is fixed. | |
String[] | getSenderIds (Context context) |
Gets the sender ids. More... | |
abstract void | onMessage (Context context, Intent intent) |
Called when a cloud message has been received. More... | |
void | onDeletedMessages (Context context, int total) |
Called when the GCM server tells pending messages have been deleted because the device was idle. More... | |
boolean | onRecoverableError (Context context, String errorId) |
Called on a registration error that could be retried. More... | |
abstract void | onError (Context context, String errorId) |
Called on registration or unregistration error. More... | |
abstract void | onRegistered (Context context, String registrationId) throws NoStorageException |
Called after a device has been registered. More... | |
abstract void | onUnregistered (Context context, String registrationId) throws NoStorageException |
Called after a device has been unregistered. More... | |
Skeleton for application-specific IntentServices responsible for handling communication from Google Cloud Messaging service.
The abstract methods in this class are called from its worker thread, and hence should run in a limited amount of time. If they execute long operations, they should spawn new threads, otherwise the worker thread will be blocked.
Subclasses must provide a public no-arg constructor.
|
protected |
Constructor that does not set a sender id, useful when the sender id is context-specific.
When using this constructor, the subclass must override getSenderIds(Context), otherwise methods such as onHandleIntent(Intent) will throw an IllegalStateException on runtime.
|
protected |
Gets the sender ids.
By default, it returns the sender ids passed in the constructor, but it could be overridden to provide a dynamic sender id.
IllegalStateException | if sender id was not set on constructor. |
|
protected |
Called when the GCM server tells pending messages have been deleted because the device was idle.
context | application's context. |
total | total number of collapsed messages |
|
protectedpure virtual |
Called on registration or unregistration error.
context | application's context. |
errorId | error id returned by the GCM service. |
Implemented in unicopa.copa.app.GCMIntentService.
|
protectedpure virtual |
Called when a cloud message has been received.
context | application's context. |
intent | intent containing the message payload as extras. |
Implemented in unicopa.copa.app.GCMIntentService.
|
protected |
Called on a registration error that could be retried.
By default, it does nothing and returns { true}, but could be overridden to change that behavior and/or display the error.
context | application's context. |
errorId | error id returned by the GCM service. |
|
protectedpure virtual |
Called after a device has been registered.
context | application's context. |
registrationId | the registration id returned by the GCM service. |
NoStorageException |
Implemented in unicopa.copa.app.GCMIntentService.
|
protectedpure virtual |
Called after a device has been unregistered.
registrationId | the registration id that was previously registered. |
context | application's context. |
NoStorageException |
Implemented in unicopa.copa.app.GCMIntentService.