BroadcastReceiver that receives Cloud Messaging events as broadcasts and delivers them to callback methods in the application-specific subclass declared in the manifest:
<receiver
android:name="com.example.YourCloudMessagingReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="YOUR_PACKAGE_NAME" />
</intent-filter>
</receiver>
The com.google.android.c2dm.permission.SEND permission is held by Google Play
services. This prevents other apps from invoking the broadcast receiver.
| class | CloudMessagingReceiver.IntentActionKeys | Actions for the wrapped Intent of notification action broadcasts to indicate the notification action type. | |
| class | CloudMessagingReceiver.IntentKeys | Keys used to pass data within the broadcast Intent's extras. | |
| final void |
| Executor |
getBroadcastExecutor()
Returns the Executor to use to handle broadcasts on.
|
| abstract int | |
| void |
onNotificationDismissed(Context
context, Bundle data)
Called when a notification created from a cloud message has been dismissed.
|
| void |
onNotificationOpen(Context
context, Bundle data)
Called when a notification created from a cloud message has been opened.
|
This method is called when the BroadcastReceiver is receiving an Intent broadcast.
Subclasses should instead override the callback
onMessageReceive(Context, CloudMessage) (and optionally
onNotificationOpen(Context, Bundle) and
onNotificationDismissed(Context, Bundle)) to handle events received by
this.
Returns the Executor to use to handle broadcasts on. Defaults to a single threaded Executor.
Called when a message is received. Runs on the Executor returned by
getBroadcastExecutor().
| context | The Context in which the receiver is running. |
|---|---|
| message | The message that is being received. |
Called when a notification created from a cloud message has been dismissed. Runs on
the Executor returned by
getBroadcastExecutor(). Defaults to do nothing.
| context | The Context in which the receiver is running. |
|---|---|
| data | Data related to the notification that was dismissed. |
Called when a notification created from a cloud message has been opened. Runs on the
Executor returned by
getBroadcastExecutor(). Defaults to do nothing.
| context | The Context in which the receiver is running. |
|---|---|
| data | Data related to the notification that was opened. |