Class 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 your AndroidManifest.xml, replacing YOURPACKAGENAME and the name of your BroadcastReceiver:
      <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> 
    See Also:
    onNotificationReceived(ProviderCloudMessage), onNotificationTapped(ProviderCloudMessage)
    • Nested Class Summary

      • Nested classes/interfaces inherited from class android.content.BroadcastReceiver

        android.content.BroadcastReceiver.PendingResult
    • 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PushAnalyticsReceiver

        public PushAnalyticsReceiver()
    • Method Detail

      • onReceive

        public final void onReceive​(android.content.Context context,
                                    android.content.Intent intent)
        Specified by:
        onReceive in class android.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 interface PushAnalyticsReceiverCallback
        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 interface PushAnalyticsReceiverCallback
        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.