Data Subject Request API Version 1 and 2
Data Subject Request API Version 3
Platform API Overview
Accounts
Apps
Audiences
Calculated Attributes
Data Points
Feeds
Field Transformations
Services
Users
Workspaces
Warehouse Sync API Overview
Warehouse Sync API Tutorial
Warehouse Sync API Reference
Data Mapping
Warehouse Sync SQL Reference
Warehouse Sync Troubleshooting Guide
ComposeID
Warehouse Sync API v2 Migration
Bulk Profile Deletion API Reference
Calculated Attributes Seeding API
Custom Access Roles API
Data Planning API
Group Identity API Reference
Pixel Service
Profile API
Events API
mParticle JSON Schema Reference
IDSync
AMP SDK
Initialization
Configuration
Network Security Configuration
Event Tracking
User Attributes
IDSync
Screen Events
Commerce Events
Location Tracking
Media
Kits
Application State and Session Management
Data Privacy Controls
Error Tracking
Opt Out
Push Notifications
WebView Integration
Logger
Preventing Blocked HTTP Traffic with CNAME
Linting Data Plans
Troubleshooting the Android SDK
API Reference
Upgrade to Version 5
Cordova Plugin
Identity
Direct URL Routing FAQ
Web
Android
iOS
Getting Started
Identity
Initialization
Configuration
Event Tracking
User Attributes
IDSync
Screen Tracking
Commerce Events
Location Tracking
Media
Kits
Application State and Session Management
Data Privacy Controls
Error Tracking
Opt Out
Push Notifications
Webview Integration
Upload Frequency
App Extensions
Preventing Blocked HTTP Traffic with CNAME
Linting Data Plans
Troubleshooting iOS SDK
Social Networks
iOS 14 Guide
iOS 15 FAQ
iOS 16 FAQ
iOS 17 FAQ
iOS 18 FAQ
API Reference
Upgrade to Version 7
Upload Frequency
Getting Started
Opt Out
Initialize the SDK
Event Tracking
Commerce Tracking
Error Tracking
Screen Tracking
Identity
Location Tracking
Session Management
Initialization
Content Security Policy
Configuration
Event Tracking
User Attributes
IDSync
Page View Tracking
Commerce Events
Location Tracking
Media
Kits
Application State and Session Management
Data Privacy Controls
Error Tracking
Opt Out
Custom Logger
Persistence
Native Web Views
Self-Hosting
Multiple Instances
Web SDK via Google Tag Manager
Preventing Blocked HTTP Traffic with CNAME
Facebook Instant Articles
Troubleshooting the Web SDK
Browser Compatibility
Linting Data Plans
API Reference
Upgrade to Version 2 of the SDK
Getting Started
Identity
Web
Alexa
Node SDK
Go SDK
Python SDK
Ruby SDK
Java SDK
Overview
Step 1. Create an input
Step 2. Verify your input
Step 3. Set up your output
Step 4. Create a connection
Step 5. Verify your connection
Step 6. Track events
Step 7. Track user data
Step 8. Create a data plan
Step 9. Test your local app
Overview
Step 1. Create an input
Step 2. Verify your input
Step 3. Set up your output
Step 4. Create a connection
Step 5. Verify your connection
Step 6. Track events
Step 7. Track user data
Step 8. Create a data plan
Step 1. Create an input
Step 2. Create an output
Step 3. Verify output
Introduction
Outbound Integrations
Firehose Java SDK
Inbound Integrations
Data Hosting Locations
Compose ID
Glossary
Migrate from Segment to mParticle
Migrate from Segment to Client-side mParticle
Migrate from Segment to Server-side mParticle
Segment-to-mParticle Migration Reference
Rules Developer Guide
API Credential Management
The Developer's Guided Journey to mParticle
Create an Input
Start capturing data
Connect an Event Output
Create an Audience
Connect an Audience Output
Transform and Enhance Your Data
The new mParticle Experience
The Overview Map
Introduction
Data Retention
Connections
Activity
Live Stream
Data Filter
Rules
Tiered Events
mParticle Users and Roles
Analytics Free Trial
Troubleshooting mParticle
Usage metering for value-based pricing (VBP)
Introduction
Sync and Activate Analytics User Segments in mParticle
User Segment Activation
Welcome Page Announcements
Project Settings
Roles and Teammates
Organization Settings
Global Project Filters
Portfolio Analytics
Analytics Data Manager Overview
Events
Event Properties
User Properties
Revenue Mapping
Export Data
UTM Guide
Data Dictionary
Query Builder Overview
Modify Filters With And/Or Clauses
Query-time Sampling
Query Notes
Filter Where Clauses
Event vs. User Properties
Group By Clauses
Annotations
Cross-tool Compatibility
Apply All for Filter Where Clauses
Date Range and Time Settings Overview
Understanding the Screen View Event
Analyses Introduction
Getting Started
Visualization Options
For Clauses
Date Range and Time Settings
Calculator
Numerical Settings
Assisted Analysis
Properties Explorer
Frequency in Segmentation
Trends in Segmentation
Did [not] Perform Clauses
Cumulative vs. Non-Cumulative Analysis in Segmentation
Total Count of vs. Users Who Performed
Save Your Segmentation Analysis
Export Results in Segmentation
Explore Users from Segmentation
Getting Started with Funnels
Group By Settings
Conversion Window
Tracking Properties
Date Range and Time Settings
Visualization Options
Interpreting a Funnel Analysis
Group By
Filters
Conversion over Time
Conversion Order
Trends
Funnel Direction
Multi-path Funnels
Analyze as Cohort from Funnel
Save a Funnel Analysis
Explore Users from a Funnel
Export Results from a Funnel
Saved Analyses
Manage Analyses in Dashboards
Dashboards––Getting Started
Manage Dashboards
Organize Dashboards
Dashboard Filters
Scheduled Reports
Favorites
Time and Interval Settings in Dashboards
Query Notes in Dashboards
User Aliasing
The Demo Environment
Keyboard Shortcuts
Analytics for Marketers
Analytics for Product Managers
Compare Conversion Across Acquisition Sources
Analyze Product Feature Usage
Identify Points of User Friction
Time-based Subscription Analysis
Dashboard Tips and Tricks
Understand Product Stickiness
Optimize User Flow with A/B Testing
User Segments
IDSync Overview
Use Cases for IDSync
Components of IDSync
Store and Organize User Data
Identify Users
Default IDSync Configuration
Profile Conversion Strategy
Profile Link Strategy
Profile Isolation Strategy
Best Match Strategy
Aliasing
Overview
Create and Manage Group Definitions
Introduction
Catalog
Live Stream
Data Plans
Blocked Data Backfill Guide
Predictive Attributes Overview
Create Predictive Attributes
Assess and Troubleshoot Predictions
Use Predictive Attributes in Campaigns
Predictive Audiences Overview
Using Predictive Audiences
Introduction
Profiles
Warehouse Sync
Data Privacy Controls
Data Subject Requests
Default Service Limits
Feeds
Cross-Account Audience Sharing
Approved Sub-Processors
Import Data with CSV Files
CSV File Reference
Glossary
Video Index
Single Sign-On (SSO)
Setup Examples
Introduction
Introduction
Introduction
Rudderstack
Google Tag Manager
Segment
Advanced Data Warehouse Settings
AWS Kinesis (Snowplow)
AWS Redshift (Define Your Own Schema)
AWS S3 Integration (Define Your Own Schema)
AWS S3 (Snowplow Schema)
BigQuery (Snowplow Schema)
BigQuery Firebase Schema
BigQuery (Define Your Own Schema)
GCP BigQuery Export
Snowflake (Snowplow Schema)
Snowplow Schema Overview
Snowflake (Define Your Own Schema)
Aliasing
The mParticle SDK can be configured to receive, show, and track the results of push notifications from various integrations such as Urban Airship and Braze.
To take advantage of push notifications you need to subscribe to a notification service. It is highly recommended that you use Firebase notifications if possible. The Google Cloud Messaging service is now deprecated. If you use any of Google’s Firebase SDKs you must use Firebase for push notifications.
Follow Google’s instructions to set up a Firebase project and add Firebase to your Android project.
Firebase
In the Firebase Console, navigate to Settings and copy the Project number value. This field was previous known as “Sender ID”
GCM (Sender ID portion deprecated)
In the Firebase Console, navigate to Settings and select the Cloud Messaging tab.
You’ll need your Sender ID to register for push notification in your app. You’ll also need to provide the Server Key to any mParticle partners you plan to use for push notifications.
Google offers many Firebase libraries, but to support push messaging, you only need the firebase-bom
, which will ensure your Firebase dependencies and a valid versioning schema, and firebase-messaging
. If you are experiencing issues fetching push token instances, you may also have to add firebase-iid
. These dependencies should be included in your build.gradle
file:
implementation(platform("com.google.firebase:firebase-bom:33.1.0"))
implementation("com.google.firebase:firebase-messaging")
implementation("com.google.firebase:firebase-iid:21.1.0")
Whether you are using FCM or GCM, you should now have a ‘Sender ID’ and a ‘Server Key’. Each device must use the ‘Sender ID’ to register for push notifications. You can either use mParticle’s messaging service to register, or you can use your own Push Instance ID service and pass the Push Token to mParticle, manually.
Once mParticle’s Instance ID Service is included in your app, the simplest way to manage registration is to use mParticle’s enablePushNotifications()
and disablePushNotifications()
methods.
First you will need to include the mParticle’s InstanceIdService
in your project’s AndroidManifest.xml
.
<service android:name="com.mparticle.messaging.InstanceIdService" />
Then enable push notifications:
//Register for push notifications
MParticle.getInstance().Messaging().enablePushNotifications("YOUR SENDER ID");
//disable push notifications
MParticle.getInstance().Messaging().disablePushNotifications();
If you are already using your own Push Instance ID service, you may continue to do so. Simply pass the token to mParticle manually using the logPushRegistration
method:
MParticle.getInstance().logPushRegistration("TOKEN", "YOUR SENDER ID");
The easiest way to deal with push notifications is to allow the mParticle SDK to handle them for you. Simply add the mParticle Service
and BroadcastReceiver
to the <application>
section of your application’s AndroidManifest.xml
.
<receiver
android:name="com.mparticle.MPReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<!-- Use your package name as the category -->
<category android:name="YOURPACKAGENAME" />
</intent-filter>
</receiver>
<!-- This is the service that does the heavy lifting in parsing, showing, and tracking FCM/GCM notifications. -->
<service android:name="com.mparticle.MPService" />
If your application targets Android Oreo (API level 26) or greater, you need to add the appcompat support library to your project by adding the following dependency to your app-level build.gradle
file:
compile 'com.android.support:appcompat-v7:26.+'
By default mParticle will not display push notifications. When a notification is received, mParticle first attempts to pass the Intent to any kit integrations with Push Notification functionality, such as Braze or Urban Airship. If no kits are able to handle the message, you can enable the mParticle SDK to display the message by setting:
MParticle.getInstance().Messaging().displayPushNotificationByDefault(true);
You can also create your own receiver to display notifications. If you choose to use your own receiver you will still need to follow the steps above to enable mParticle’s Broadcast Receiver. mParticle will pass an Intent to your receiver if there are no kits that can display the notification.
Create a class that extends the Android SDK’s PushAnalyticsReceiver
BroadcastReceiver
class:
public class MyReceiver extends PushAnalyticsReceiver {
@Override
public boolean onNotificationReceived(ProviderCloudMessage message) {
//Do something
return super.onNotificationReceived(message);
}
@Override
public boolean onNotificationTapped(ProviderCloudMessage message) {
//Do something
return super.onNotificationTapped(message);
}
}
class MyReceiver : PushAnalyticsReceiver {
override fun onNotificationReceived(message: ProviderCloudMessage) : Boolean {
//Do something
return super.onNotificationReceived(message);
}
override fun onNotificationTapped(message: ProviderCloudMessage) : Boolean {
//Do something
return super.onNotificationTapped(message);
}
}
Then, you can register an Instance of your class with the registerPushAnalyticsReceiver
method in the MessagingAPI
MParticle.getInstance().Messaging().registerPushAnalyticsReceiver(new MyReceiver());
MParticle.getInstance().Messaging().registerPushAnalyticsReceiver(MyReceiver());
Alternativly, if you would like to register your Instance manually, you can do so directly via the LocalBroadcastManager
, using our publically available actions
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(BROADCAST_NOTIFICATION_RECEIVED);
intentFilter.addAction(BROADCAST_NOTIFICATION_TAPPED);
LocalBroadcastManager.getInstance(mContext).registerReceiver(receiver, intentFilter);
IntentFilter().apply {
addAction(BROADCAST_NOTIFICATION_RECEIVED);
addAction(BROADCAST_NOTIFICATION_TAPPED);
}.also {
LocalBroadcastManager.getInstance(mContext).registerReceiver(receiver, it)
}
At any time, if you wish to stop receiving notifications via the PushAnalyticsReceiver’s callbacks, you can unregister your instance by calling following API method
MParticle.getInstance().Messaging().unregisterPushAnalyticsReceiver(myReceiver);
or by interacting with the LocalBroadcastManager
directly. Please be aware this is reference-based, so you need a reference to your original Instance in order to unregister it
If choose to handle push notifications yourself, you should still notify mParticle that notifications have been received and opened, so that these events can be tracked. Send these events with the logNotification
and logNotificationOpened
methods:
//received
MParticle.getInstance().logNotification(intentObject);
//opened
MParticle.getInstance().logNotificationOpened(intentObject);
The following Kit integrations can receive push notifications:
Push notifications from any of these partners are displayed by the relevant kit instance. Note that you must provide your Server Key to the partner in order to send push notifications. See the docs for each integration for details.
Was this page helpful?