CopaApp
Change of Plan Application
 All Classes Functions Variables Pages
Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
unicopa.copa.app.gcm.GCMBaseIntentService Class Referenceabstract

Skeleton for application-specific IntentServices responsible for handling communication from Google Cloud Messaging service. More...

Inheritance diagram for unicopa.copa.app.gcm.GCMBaseIntentService:
Inheritance graph
Collaboration diagram for unicopa.copa.app.gcm.GCMBaseIntentService:
Collaboration graph

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

unicopa.copa.app.gcm.GCMBaseIntentService.GCMBaseIntentService ( )
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.

Member Function Documentation

String [] unicopa.copa.app.gcm.GCMBaseIntentService.getSenderIds ( Context  context)
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.

Exceptions
IllegalStateExceptionif sender id was not set on constructor.
void unicopa.copa.app.gcm.GCMBaseIntentService.onDeletedMessages ( Context  context,
int  total 
)
protected

Called when the GCM server tells pending messages have been deleted because the device was idle.

Parameters
contextapplication's context.
totaltotal number of collapsed messages
abstract void unicopa.copa.app.gcm.GCMBaseIntentService.onError ( Context  context,
String  errorId 
)
protectedpure virtual

Called on registration or unregistration error.

Parameters
contextapplication's context.
errorIderror id returned by the GCM service.

Implemented in unicopa.copa.app.GCMIntentService.

abstract void unicopa.copa.app.gcm.GCMBaseIntentService.onMessage ( Context  context,
Intent  intent 
)
protectedpure virtual

Called when a cloud message has been received.

Parameters
contextapplication's context.
intentintent containing the message payload as extras.

Implemented in unicopa.copa.app.GCMIntentService.

boolean unicopa.copa.app.gcm.GCMBaseIntentService.onRecoverableError ( Context  context,
String  errorId 
)
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.

Parameters
contextapplication's context.
errorIderror id returned by the GCM service.
Returns
if { true}, failed operation will be retried (using exponential backoff).
abstract void unicopa.copa.app.gcm.GCMBaseIntentService.onRegistered ( Context  context,
String  registrationId 
) throws NoStorageException
protectedpure virtual

Called after a device has been registered.

Parameters
contextapplication's context.
registrationIdthe registration id returned by the GCM service.
Exceptions
NoStorageException

Implemented in unicopa.copa.app.GCMIntentService.

abstract void unicopa.copa.app.gcm.GCMBaseIntentService.onUnregistered ( Context  context,
String  registrationId 
) throws NoStorageException
protectedpure virtual

Called after a device has been unregistered.

Parameters
registrationIdthe registration id that was previously registered.
contextapplication's context.
Exceptions
NoStorageException

Implemented in unicopa.copa.app.GCMIntentService.


The documentation for this class was generated from the following file: