Class MPMessagingAPI


  • public class MPMessagingAPI
    extends java.lang.Object
    DO NOT DIRECTLY INSTANTIATE THIS CLASS! Utility class to enable and adjust push notification behavior.
    See Also:
    MParticle.Messaging()
    • Field Detail

      • CLOUD_MESSAGE_EXTRA

        @NonNull
        public static final java.lang.String CLOUD_MESSAGE_EXTRA
        See Also:
        Constant Field Values
      • BROADCAST_NOTIFICATION_RECEIVED

        @NonNull
        public static final java.lang.String BROADCAST_NOTIFICATION_RECEIVED
        Listen for this broadcast (as an Intent action) to detect when the device received a push. In the received Intent, you will have access to the entire payload of the push notification.
        See Also:
        Constant Field Values
      • BROADCAST_NOTIFICATION_TAPPED

        @NonNull
        public static final java.lang.String BROADCAST_NOTIFICATION_TAPPED
        Listen for this broadcast (as an Intent action) to detect when a user taps a push message in the notification bar of their device. You may then navigate or otherwise adjust the user experience based on the payload of the push. In the received Intent, you will have access to the entire payload of the push notification.
        See Also:
        Constant Field Values
    • Constructor Detail

      • MPMessagingAPI

        public MPMessagingAPI​(@NonNull
                              android.content.Context context)
    • Method Detail

      • enablePushNotifications

        public void enablePushNotifications​(@NonNull
                                            java.lang.String senderId)
        Register the application for FCM notifications.
        Parameters:
        senderId - the SENDER_ID for the application
      • disablePushNotifications

        public void disablePushNotifications()
        Unregister the application for FCM notifications.
      • displayPushNotificationByDefault

        public void displayPushNotificationByDefault​(@Nullable
                                                     java.lang.Boolean enabled)
      • registerPushAnalyticsReceiver

        public void registerPushAnalyticsReceiver​(@NonNull
                                                  PushAnalyticsReceiver receiver)
        Register a custom implementation of PushAnalyticsReceiver, which will provide callbacks when push messages are received.
        Parameters:
        receiver - the implementation of PushAnalyticsReceiver to be registered
        See Also:
        PushAnalyticsReceiver
      • unregisterPushAnalyticsReceiver

        public void unregisterPushAnalyticsReceiver​(@Nullable
                                                    PushAnalyticsReceiver receiver)
        Unregister you custom implementation of PushAnalyticsReceiver. If the receiver is not found to have been registered, nothing will happen.
        Parameters:
        receiver - the previously registered implementation of PushAnalyticsReceiver to be unregistered
        See Also:
        PushAnalyticsReceiver