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
BroadcastReceiverto 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, replacingYOURPACKAGENAMEand 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 booleanonNotificationReceived(ProviderCloudMessage message)Override this method to listen for when a notification has been received.booleanonNotificationTapped(ProviderCloudMessage message)Override this method to listen for when a notification has been tapped or acted on.voidonReceive(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:
onReceivein classandroid.content.BroadcastReceiver
-
onNotificationReceived
public boolean onNotificationReceived(ProviderCloudMessage message)
Description copied from interface:PushAnalyticsReceiverCallbackOverride this method to listen for when a notification has been received.- Specified by:
onNotificationReceivedin 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:PushAnalyticsReceiverCallbackOverride this method to listen for when a notification has been tapped or acted on.- Specified by:
onNotificationTappedin 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.
-
-