Package com.mparticle.messaging
Class PushAnalyticsReceiver
- java.lang.Object
-
- android.content.BroadcastReceiver
-
- com.mparticle.messaging.PushAnalyticsReceiver
-
- All Implemented Interfaces:
PushAnalyticsReceiverCallback
public class PushAnalyticsReceiver extends android.content.BroadcastReceiver implements PushAnalyticsReceiverCallback
BroadcastReceiver
to be used to listen for, manipulate, and react to FCM notifications. In order to use this class: 1. Create your own class which extends this one, for example MyPushReceiver.java 2. Add the following to yourAndroidManifest.xml
, replacingYOURPACKAGENAME
and the name of yourBroadcastReceiver
:<receiver android:exported="true" android:name="YOURPACKAGENAME.MyPushReceiver"> <intent-filter> <action android:name="com.mparticle.push.RECEIVE" /> <action android:name="com.mparticle.push.TAP" /> <category android:name="YOURPACKAGENAME"/> </intent-filter> </receiver>
-
-
Constructor Summary
Constructors Constructor Description PushAnalyticsReceiver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
onNotificationReceived(ProviderCloudMessage message)
Override this method to listen for when a notification has been received.boolean
onNotificationTapped(ProviderCloudMessage message)
Override this method to listen for when a notification has been tapped or acted on.void
onReceive(android.content.Context context, android.content.Intent intent)
-
Methods inherited from class android.content.BroadcastReceiver
abortBroadcast, clearAbortBroadcast, getAbortBroadcast, getDebugUnregister, getResultCode, getResultData, getResultExtras, goAsync, isInitialStickyBroadcast, isOrderedBroadcast, peekService, setDebugUnregister, setOrderedHint, setResult, setResultCode, setResultData, setResultExtras
-
-
-
-
Method Detail
-
onReceive
public final void onReceive(android.content.Context context, android.content.Intent intent)
- Specified by:
onReceive
in classandroid.content.BroadcastReceiver
-
onNotificationReceived
public boolean onNotificationReceived(ProviderCloudMessage message)
Description copied from interface:PushAnalyticsReceiverCallback
Override this method to listen for when a notification has been received.- Specified by:
onNotificationReceived
in interfacePushAnalyticsReceiverCallback
- Parameters:
message
- The message that was received. Depending on the push provider- Returns:
- True if you would like to handle this notification, False if you would like the mParticle to generate and show a
Notification
.
-
onNotificationTapped
public boolean onNotificationTapped(ProviderCloudMessage message)
Description copied from interface:PushAnalyticsReceiverCallback
Override this method to listen for when a notification has been tapped or acted on.- Specified by:
onNotificationTapped
in interfacePushAnalyticsReceiverCallback
- Parameters:
message
- The message that was tapped. Depending on the push provider- Returns:
- True if you would like to consume this tap/action, False if the mParticle SDK should attempt to handle it.
-
-