Package com.mparticle
Class MPReceiver
- java.lang.Object
 - 
- android.content.BroadcastReceiver
 - 
- com.mparticle.MPReceiver
 
 
 
- 
public class MPReceiver extends android.content.BroadcastReceiverCoreBroadcastReceiverused to support push notifications. Handles the following Intent actions:com.google.android.c2dm.intent.RECEIVEandroid.intent.action.PACKAGE_REPLACEDandroid.intent.action.BOOT_COMPLETED
BroadcastReceivermust be specified within the<application>block of your application'sAndroidManifest.xmlfile:<receiver android:exported="true" android:name="com.mparticle.MPReceiver" android:permission="com.google.android.c2dm.permission.SEND" > <intent-filter> <action android:name="com.google.android.c2dm.intent.REGISTRATION" /> <action android:name="com.google.android.c2dm.intent.RECEIVE" /> <action android:name="com.google.android.c2dm.intent.UNREGISTER"/> <!-- Use your application's package name as the category --> <category android:name="<YOUR_PACKAGE_NAME_HERE>" /> </intent-filter> <!-- The FCM registration ID could change on an app upgrade, this filter will allow mParticle to re-register for push notifications if necessary. --> <intent-filter> <action android:name="android.intent.action.PACKAGE_REPLACED" /> <!-- Use your application's package name as the path --> <data android:path="<YOUR_PACKAGE_NAME_HERE>" android:scheme="package" /> </intent-filter> <!-- The FCM registration ID could change if the device's Android version changes, this filter will allow mParticle to re-register for push notifications if necessary. --> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> </intent-filter> </receiver> 
- 
- 
Field Summary
Fields Modifier and Type Field Description static java.lang.StringMPARTICLE_IGNORE 
- 
Constructor Summary
Constructors Constructor Description MPReceiver() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanonNotificationReceived(ProviderCloudMessage message)Override this method to listen for when a notification has been received.protected 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 
 - 
 
 - 
 
- 
- 
Field Detail
- 
MPARTICLE_IGNORE
@NonNull public static final java.lang.String MPARTICLE_IGNORE
- See Also:
 - Constant Field Values
 
 
 - 
 
- 
Method Detail
- 
onReceive
public final void onReceive(@NonNull android.content.Context context, @NonNull android.content.Intent intent)- Specified by:
 onReceivein classandroid.content.BroadcastReceiver
 
- 
onNotificationReceived
protected boolean onNotificationReceived(@NonNull ProviderCloudMessage message)Override this method to listen for when a notification has been received.- Parameters:
 message- The message that was received.- Returns:
 - True if you would like to handle this notification, False if you would like the mParticle to generate and show a 
Notification. 
 
- 
onNotificationTapped
protected boolean onNotificationTapped(@NonNull ProviderCloudMessage message)Override this method to listen for when a notification has been tapped or acted on.- Parameters:
 message- The message that was tapped.- Returns:
 - True if you would like to consume this tap/action, False if the mParticle SDK should attempt to handle it.
 
 
 - 
 
 -