Data Subject Request API Version 1 and 2
Data Subject Request API Version 3
Key Management
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
Audit Logs API
Bulk Profile Deletion API Reference
Calculated Attributes Seeding API
Custom Access Roles API
Data Planning API
Household Reach API Reference
Profile API
Pixel Service
Events API
mParticle JSON Schema Reference
IDSync
AMP SDK
Direct URL Routing FAQ
Web
Android
iOS
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
Workspace Switching
Linting Data Plans
Troubleshooting the Android SDK
API Reference
Upgrade to Version 5
Upgrade to Version 6
Workspace Switching
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
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
Upgrade to Version 9
Getting Started
Identity
Upgrade to Version 4
Getting Started
Identity
Upload Frequency
Getting Started
Opt Out
Initialize the SDK
Event Tracking
Commerce Tracking
Error Tracking
Screen Tracking
Identity
Location Tracking
Session Management
Initialization
Configuration
Content Security Policy
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 3 of the SDK
Alexa
Introduction
Outbound Integrations
Firehose Java SDK
Inbound Integrations
Compose ID
Migrate from Segment to mParticle
Migrate from Segment to Client-side mParticle
Migrate from Segment to Server-side mParticle
Segment-to-mParticle Migration Reference
Data Hosting Locations
Glossary
Rules Developer Guide
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
Node SDK
Go SDK
Python SDK
Ruby SDK
Java SDK
API Credential Management
The Developer's Guided Journey to mParticle
Introduction
Navigating mParticle
The Overview Map
Create an Input
Start capturing data
Connect an Event Output
Create an Audience
Connect an Audience Output
Transform and Enhance Your Data
Overview
Explore Your Data
Build Audiences
Create Predictions
Data and Privacy
mParticle Agent FAQ
System Alerts
Trends
Connections
Feeds
Import Data with CSV Files
CSV File Reference
SFTP Credentials
Live Stream
Data Catalog
Rules
Plans
Filters
Event Forwarding
Event Match Quality
Data Retention
Tiered Events
Blocked Data Backfill Guide
Warehouse Setup Overview
Overview
Overview
User Profiles
Identity Dashboard
Identity Resolution Log
Household Reach
Calculated Attributes Overview
Using Calculated Attributes
Create with AI Assistance
Calculated Attributes Reference
Predictions Overview
What's Changed in the New Predictions UI
View and Manage Predictions
Future Behavior Predictions Overview
Create Future Behavior Prediction
Manage Future Behavior Predictions
Create an Audience with Future Behavior Predictions
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
Real-Time Personalization
Audiences Overview
Create an Audience
Connect an Audience
Manage Audiences
Audience Insights
Audience Sharing
Match Boost
Inclusive & Exclusive Audiences Overview
Using Logic Blocks in Audiences
Combining Inclusive and Exclusive Audiences
Inclusive & Exclusive Audiences FAQ
Audience Expansion
Probabilistic Reach
Predictive Audiences Overview
Using Predictive Audiences
Composable Audiences Overview
User Guide Overview
Audience Setup
Frequently Asked Questions
Troubleshooting mParticle
Default Service Limits
Glossary
Event
Audience
Audience
Feed
Event
Audience
Cookie Sync
Platform SDK Events
Server-to-Server Events
Audience
Audience
Event
Audience
Feed
Event
Event
Event
Event
Data Warehouse
Event
Audience
Feed
Event
Event
Event
Audience
Event
Event
Event
Event
Feed
Event
Event
Event
Audience
Feed
Event
Event
Event
Custom Feed
Event
Data Warehouse
Event
Audience
Audience
Audience
Event
Audience
Event
Event
Event
Event
Event
Audience
Audience
Event
Event
Audience
Data Warehouse
Event
Event
Event
Audience
Cookie Sync
Event
Event
Event
Feed
Event
Feed
Event
Event
Event
Kit
Audience
Event
Audience
Event
Event
Event
Event
Feed
Audience
Event
Audience
Event
Event
Audience
Audience
Audience
Microsoft Ads Audience Integration
Audience
Event
Audience
Event
Event
Event
Event
Feed
Event
Event
Event
Event
Feed
Event
Audience
Event
Event
Event
Event
Event
Feed
Event
Event
Event
Event
Event
Audience
Event
Event
Event
Custom Pixel
Feed
Audience
Event
Event
Event
Audience
Data Warehouse
Event
Event
Event
Audience
Audience
Audience
Event
Loyalty Feed
Feed
Event
Audience
Audience
Audience
Feed
Cookie Sync
Audience
Event
Audience
Event
Audience
Event
Audience
Audience
Event
Event
Event
Event
Feed
Audience
Cookie Sync
Audience
Audience
Cookie Sync
Many functions of the Android SDK are customizable via the MParticleOptions object, a few examples of which are documented below. Reference the complete API Reference for all of the configuration options.
All data sent into an mParticle input must be marked as either “development” or “production”. The SDK attempts to detect the environment by based on whether the Android APK is “debuggable” according to its AndroidManifest.xml, setting it to development-mode when the API is debuggable.
In addition to uploading data as development, the SDK will also adjust some of its functionality to allow for a faster integration process:
IllegalArgumentException and IllegalStateException exceptions when invalid objects are passed to its APIs, such as the IDSync and commerce APIs.You can override the environment in your MParticleOptions object:
MParticleOptions.Builder options = MParticleOptions.builder(this);
options.environment(MParticle.Environment.Production);var options = MParticleOptions.builder(this)
options.environment(MParticle.Environment.Production)All development data will appear in your workspace’s live stream. In order to see production data, log into the mParticle platform, navigate to live stream, select your app, and filter on the appropriate devices based on Google Ad ID (GAID).
Data Planning allows you to define the format of any data being sent to the mParticle SDK. After creating a data plan in the mParticle UI, you simply set the data plan ID in the MParticleOptions object along with the optional data plan version and initialize the SDK as normal. When you return to the mParticle UI and visit the Live Stream section to view incoming data, you’ll find warnings for any data that has been received that does not conform to your data plan.
MParticleOptions options = MParticleOptions.builder(this)
.credentials("REPLACE WITH APP KEY", "REPLACE WITH APP SECRET")
.environment(MParticle.Environment.Development)
.dataplan("mobile_data_plan", 2)
.build()
MParticle.start(options)var options = MParticleOptions.builder(this)
.credentials("REPLACE WITH APP KEY", "REPLACE WITH APP SECRET")
.environment(MParticle.Environment.Development)
.dataplan("mobile_data_plan", 2)
.build()
MParticle.start(options)You can configure the log level via the loglevel property of the MParticleOptions object:
MParticleOptions.Builder options = MParticleOptions.builder(this);
options.logLevel(MParticle.LogLevel.VERBOSE);var options = MParticleOptions.builder(this)
options.logLevel(MParticle.LogLevel.VERBOSE)You can also enable logging at runtime using the adb setprop command with the “mParticle” tag:
adb shell setprop log.tag.mParticle VERBOSEReference the Android development documentation for more information on issuing adb commands.
Set a maximum threshold for stored events, batches, and sessions, in seconds.
By default, data is persisted for 90 days before being deleted to minimize data loss, however this can lead to excessive storage usage on some users’ devices. This is exacerbated if you log a large number of events, or events with a lot of data (attributes, etc).
You can set this to any value greater than 0 seconds, so if you have storage usage concerns, set a lower value such as 48 hours or 1 week. Or alternatively, if you have data loss concerns, you can set this to an even longer value than the default.
The SDK performs an age-based sweep of persisted messages, uploads, and sessions during the upload cycle. That sweep is throttled to run at most once every 24 hours. Rows with a timestamp strictly older than now - persistenceMaxAgeSeconds are deleted.
If you pass zero or a negative value, the SDK logs a warning and uses the default retention period instead.
Use MParticleOptions.Builder.persistenceMaxAgeSeconds(int) to set this value, and MParticleOptions.getPersistenceMaxAgeSeconds() to read back the configured value (this may be null when unset).
Default value: 90 days (7,776,000 seconds)
MParticleOptions.Builder options = MParticleOptions.builder(this);
options.persistenceMaxAgeSeconds(604800);var options = MParticleOptions.builder(this)
options.persistenceMaxAgeSeconds(604800)To save bandwidth and device battery, mParticle does not upload each event as it is recorded. Instead, events are assembled into batches and uploaded based on specific triggers. When a trigger is fired, the SDK will:
The following will trigger SDK batch creation and upload:
upload API is invoked (see below)You can configure the regular upload trigger:
MParticleOptions.Builder options = MParticleOptions.builder(this);
options.uploadInterval(60)var options = MParticleOptions.builder(this)
options.uploadInterval(60)You can also force an upload trigger with the upload method:
MParticle.getInstance().upload();MParticle.getInstance().upload()In addition to the Google Play Store and its compatible Android devices, the same core Android SDK also supports Amazon’s Fire TV store and platform. Within a Fire TV app, the core Android SDK will attempt to query for the Amazon Advertising ID (instead of the Google Advertising ID), but otherwise the SDK functions identically.
In order to use the Android SDK within a Fire TV app, you must override the OperatingSystem during SDK initialization:
MParticleOptions options = MParticleOptions.builder(this)
.operatingSystem(MParticle.OperatingSystem.FIRE_OS)var options = MParticleOptions.builder(this)
.operatingSystem(MParticle.OperatingSystem.FIRE_OS)You can disable specific kits by listing each kit ID in disabledKits in MParticleOptions. When a kit is disabled, it will not be initialized even if it is set to Active in your mParticle workspace, and it will not receive any events from the SDK implementation where it’s disabled. This can be useful if you need to programmatically disable a kit based on certain conditions, or if you need to set a feature flag.
MParticleOptions options = MParticleOptions.builder(this)
.disabledKits(
Arrays.asList(
MParticle.ServiceProviders.ADJUST,
MParticle.ServiceProviders.APPBOY,
MParticle.ServiceProviders.CLEVERTAP
)
)val options = MParticleOptions.builder(this)
.disabledKits(
listOf(
MParticle.ServiceProviders.ADJUST,
MParticle.ServiceProviders.APPBOY,
MParticle.ServiceProviders.CLEVERTAP
)
)Was this page helpful?