Package com.mparticle
Class MParticle
- java.lang.Object
-
- com.mparticle.MParticle
-
public class MParticle extends java.lang.Object
The primary access point to the mParticle SDK. In order to use this class, you must first callstart(MParticleOptions)
. You can then retrieve a reference to an instance of this class viagetInstance()
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MParticle.Environment
The Environment in which the SDK and hosting app are running.static class
MParticle.EventType
Event type to use when loggingMPEvent
s.static class
MParticle.IdentityType
Identity type to use when setting the user identity.static class
MParticle.InstallType
To be used when initializing MParticle.static class
MParticle.LogLevel
Enumeration used to moderate the amount of messages that are printed by the SDK to the console.static class
MParticle.OperatingSystem
static interface
MParticle.ResetListener
static interface
MParticle.ServiceProviders
This interface defines constants that can be used to interact with specific 3rd-party services.static interface
MParticle.UserAttributes
This interface defines a series of constants that can be used to specify certain characteristics of a user.
-
Field Summary
Fields Modifier and Type Field Description protected boolean
locationTrackingEnabled
protected android.content.Context
mAppContext
protected com.mparticle.internal.AppStateManager
mAppStateManager
The state manager is primarily concerned with Activity lifecycle and app visibility in order to manage sessions, automatically log screen views, and pass lifecycle information on top embedded kits.protected AttributionListener
mAttributionListener
protected com.mparticle.internal.ConfigManager
mConfigManager
protected com.mparticle.internal.database.services.MParticleDBManager
mDatabaseManager
protected IdentityApi
mIdentityApi
protected MParticle.Internal
mInternal
protected com.mparticle.internal.KitFrameworkWrapper
mKitManager
Used to delegate messages, events, user actions, etc on to embedded kits.protected com.mparticle.internal.MPLocationListener
mLocationListener
protected MPMediaAPI
mMedia
protected com.mparticle.internal.MessageManager
mMessageManager
protected MPMessagingAPI
mMessaging
protected android.content.SharedPreferences
mPreferences
-
Constructor Summary
Constructors Modifier Constructor Description protected
MParticle()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static void
addListener(android.content.Context context, SdkListener listener)
NOTE: Experimental feature, adding a Listener will slow down the SDK, and should be used only for development purposes.void
disableLocationTracking()
Disables any mParticle location tracking that had been started.void
disableUncaughtExceptionLogging()
Disables mParticle exception handling and restores the original UncaughtExceptionHandler.void
enableLocationTracking(java.lang.String provider, long minTime, long minDistance)
Enables location tracking given a provider and update frequency criteria.void
enableUncaughtExceptionLogging()
Enable mParticle exception handling to automatically log events on uncaught exceptions.AttributionListener
getAttributionListener()
Retrieve the current Attribution Listener.java.util.Map<java.lang.Integer,AttributionResult>
getAttributionResults()
Queries the attribution results.Session
getCurrentSession()
Query for a read-only Session API object.static java.lang.String
getDeviceImei()
Get the device's current IMEI.MParticle.Environment
getEnvironment()
Get the current Environment that the SDK has interpreted.java.lang.String
getInstallReferrer()
Retrieve the current install referrer, if it has been set.static MParticle
getInstance()
Retrieve an instance of the MParticle class.java.util.Map<java.lang.String,java.lang.String>
getIntegrationAttributes(int integrationId)
Queries the current integration attributes for a given integration ID.java.lang.Object
getKitInstance(int kitId)
Retrieve the underlying object for the given Kit Id for direct calls.java.lang.Boolean
getOptOut()
Get the current opt-out status for the application.int
getSessionTimeout()
Retrieves the current session timeout setting in secondsandroid.net.Uri
getSurveyUrl(int kitId)
Retrieve a URL to be loaded within aWebView
to show the user a survey or feedback form.void
getUserSegments(long timeout, java.lang.String endpointId, SegmentListener listener)
IdentityApi
Identity()
void
incrementSessionAttribute(java.lang.String key, int value)
Increment a single session attribute.MParticle.Internal
Internal()
static boolean
isAndroidIdDisabled()
Deprecated.This method has been replaced as the behavior has been inverted - Android ID collection is now disabled by default.static boolean
isAndroidIdEnabled()
Query the status of Android ID collection.java.lang.Boolean
isAutoTrackingEnabled()
Retrieves the current setting of automatic screen tracking.boolean
isDevicePerformanceMetricsDisabled()
Query whether device performance metrics are disabledboolean
isKitActive(int serviceProviderId)
Detect whether the given service provider kit is active.boolean
isLocationTrackingEnabled()
Retrieves the current setting of location tracking.boolean
isProviderActive(int serviceProviderId)
Deprecated.void
leaveBreadcrumb(java.lang.String breadcrumb)
Leave a breadcrumb to be included with error and exception logging, as well as with regular session events.void
logError(java.lang.String message)
Logs an error event.void
logError(java.lang.String message, java.util.Map<java.lang.String,java.lang.String> errorAttributes)
Logs an error eventvoid
logEvent(BaseEvent event)
void
logException(java.lang.Exception exception)
Logs an Exception.void
logException(java.lang.Exception exception, java.util.Map<java.lang.String,java.lang.String> eventData)
Logs an Exception.void
logException(java.lang.Exception exception, java.util.Map<java.lang.String,java.lang.String> eventData, java.lang.String message)
Logs an Exception.void
logLtvIncrease(java.math.BigDecimal valueIncreased, java.lang.String eventName, java.util.Map<java.lang.String,java.lang.String> contextInfo)
Logs an increase in the lifetime value of a user.void
logNetworkPerformance(java.lang.String url, long startTime, java.lang.String method, long length, long bytesSent, long bytesReceived, java.lang.String requestString, int responseCode)
void
logNotification(android.content.Intent intent)
Logs a Push Notification displayed to the User.void
logNotificationOpened(android.content.Intent intent)
Logs a Push Notification has been tapped or opened.void
logPushRegistration(java.lang.String instanceId, java.lang.String senderId)
void
logScreen(MPEvent screenEvent)
Logs a screen view event.void
logScreen(java.lang.String screenName)
Logs a screen view event.void
logScreen(java.lang.String screenName, java.util.Map<java.lang.String,java.lang.String> eventData)
Logs a screen view event.void
logScreen(java.lang.String screenName, java.util.Map<java.lang.String,java.lang.String> eventData, java.lang.Boolean shouldUploadEvent)
Logs a screen view event.MPMediaAPI
Media()
Entry point to the Media APIs.MPMessagingAPI
Messaging()
Entry point to the Messaging APIs.void
registerWebView(android.webkit.WebView webView)
Instrument a WebView so that communication can be facilitated between this Native SDK instance and any instance of the mParticle Javascript SDK is loaded within the provided WebView.void
registerWebView(android.webkit.WebView webView, java.lang.String requiredBridgeName)
Instrument a WebView so that communication can be facilitated between this Native SDK instance and any instance of the mParticle Javascript SDK is loaded within the provided WebView.void
removeAttributionListener()
Clears the current Attribution Listener.static void
removeListener(SdkListener listener)
Remove an instance ofSdkListener
.static void
reset(android.content.Context context)
This method will permanently remove ALL MParticle data from the device, included SharedPreferences and Database, and halt any upload or download behavior that may be in process.static void
reset(android.content.Context context, MParticle.ResetListener callback)
This method will permanently remove ALL MParticle data from the device, included SharedPreferences and Database, and halt any upload or download behavior that may be in process.static void
setDeviceImei(java.lang.String deviceImei)
Set the device's current IMEI.void
setInstallReferrer(java.lang.String referrer)
Manually set the install referrer.static void
setInstance(MParticle instance)
Use this method for your own unit testing.void
setIntegrationAttributes(int integrationId, java.util.Map<java.lang.String,java.lang.String> attributes)
Set or remove the integration attributes for a given integration ID.void
setLocation(android.location.Location location)
Set the current location of the active session.static void
setLogLevel(MParticle.LogLevel level)
Set the minimum log level before the SDK is initialized.void
setOptOut(java.lang.Boolean optOutStatus)
Control the opt-in/opt-out status for the application.void
setSessionAttribute(java.lang.String key, java.lang.Object value)
Set a single session attribute.static void
start(MParticleOptions options)
Start the mParticle SDK and begin tracking a user session.void
upload()
Force upload all queued messages to the mParticle server.
-
-
-
Field Detail
-
mKitManager
@NonNull protected com.mparticle.internal.KitFrameworkWrapper mKitManager
Used to delegate messages, events, user actions, etc on to embedded kits.
-
mAppStateManager
@NonNull protected com.mparticle.internal.AppStateManager mAppStateManager
The state manager is primarily concerned with Activity lifecycle and app visibility in order to manage sessions, automatically log screen views, and pass lifecycle information on top embedded kits.
-
mConfigManager
@NonNull protected com.mparticle.internal.ConfigManager mConfigManager
-
mMessageManager
@NonNull protected com.mparticle.internal.MessageManager mMessageManager
-
mPreferences
@NonNull protected android.content.SharedPreferences mPreferences
-
mLocationListener
@NonNull protected com.mparticle.internal.MPLocationListener mLocationListener
-
mAppContext
@NonNull protected android.content.Context mAppContext
-
mMessaging
@NonNull protected MPMessagingAPI mMessaging
-
mMedia
@NonNull protected MPMediaAPI mMedia
-
mDatabaseManager
@NonNull protected com.mparticle.internal.database.services.MParticleDBManager mDatabaseManager
-
mAttributionListener
@NonNull protected volatile AttributionListener mAttributionListener
-
mIdentityApi
@NonNull protected IdentityApi mIdentityApi
-
locationTrackingEnabled
@NonNull protected boolean locationTrackingEnabled
-
mInternal
@NonNull protected MParticle.Internal mInternal
-
-
Method Detail
-
start
public static void start(@NonNull MParticleOptions options)
Start the mParticle SDK and begin tracking a user session. This method must be called prior togetInstance()
.- Parameters:
options
- Required to initialize the SDK properly
-
getInstance
@Nullable public static MParticle getInstance()
Retrieve an instance of the MParticle class.start(MParticleOptions)
must be called prior to this.- Returns:
- An instance of the mParticle SDK configured with your API key
-
setInstance
public static void setInstance(@Nullable MParticle instance)
Use this method for your own unit testing. Using a framework such as Mockito, or by extending MParticle, use this method to set a mock of mParticle.- Parameters:
instance
-
-
isAndroidIdDisabled
@Deprecated public static boolean isAndroidIdDisabled()
Deprecated.This method has been replaced as the behavior has been inverted - Android ID collection is now disabled by default.Use
androidIdEnabled(boolean)
instead. Query the status of Android ID collection. By default, the SDK will NOT collect Android Id for the purpose of anonymous analytics. If you're not using an mParticle integration that consumes Android ID and you would like to collect it, use this API to enable collection- Returns:
- false if Android ID collection is enabled. (true by default)
- See Also:
MParticleOptions.Builder.androidIdEnabled(boolean)
-
isAndroidIdEnabled
public static boolean isAndroidIdEnabled()
Query the status of Android ID collection. By default, the SDK will NOT collect Android Id for the purpose of anonymous analytics. If you're not using an mParticle integration that consumes Android ID and you would like to collect it, use this API to enable collection.- Returns:
- true if Android ID collection is enabled. (false by default)
- See Also:
MParticleOptions.Builder.androidIdEnabled(boolean)
-
setDeviceImei
public static void setDeviceImei(@Nullable java.lang.String deviceImei)
Set the device's current IMEI. The mParticle SDK does not collect IMEI but you may use this API to provide it. Collecting the IMEI is generally unnecessary and discouraged for apps in Google Play. For apps distributed outside of Google Play, IMEI may be necessary for accurate install attribution. The mParticle SDK does not persist this value - it must be set whenever the SDK is initialized.- Parameters:
deviceImei
- a string representing the device's current IMEI, or null to remove clear it.
-
getDeviceImei
@Nullable public static java.lang.String getDeviceImei()
Get the device's current IMEI. The mParticle SDK does not collect IMEI but you may use thesetDeviceImei(String)
API to provide it.. Collecting the IMEI is generally unnecessary and discouraged for apps in Google Play. For apps distributed outside of Google Play, IMEI may be necessary for accurate install attribution. The mParticle SDK does not persist this value - it must be set whenever the SDK is initialized.- Returns:
- a string representing the device's current IMEI, or null if not set.
-
isDevicePerformanceMetricsDisabled
public boolean isDevicePerformanceMetricsDisabled()
Query whether device performance metrics are disabled- Returns:
- true if Device Performance Metrics are disabled
-
getCurrentSession
@Nullable public Session getCurrentSession()
Query for a read-only Session API object.
-
upload
public void upload()
Force upload all queued messages to the mParticle server.
-
setInstallReferrer
public void setInstallReferrer(@Nullable java.lang.String referrer)
Manually set the install referrer. This will replace any install referrer that was automatically retrieved upon installation from Google Play.
-
getInstallReferrer
@Nullable public java.lang.String getInstallReferrer()
Retrieve the current install referrer, if it has been set.- Returns:
- The current Install Referrer
-
logEvent
public void logEvent(@NonNull BaseEvent event)
-
logLtvIncrease
public void logLtvIncrease(@NonNull java.math.BigDecimal valueIncreased, @Nullable java.lang.String eventName, @Nullable java.util.Map<java.lang.String,java.lang.String> contextInfo)
Logs an increase in the lifetime value of a user. This will signify an increase in the revenue assigned to this user for service providers that support revenue tracking.- Parameters:
valueIncreased
- The currency value by which to increase the current user's LTV (required)eventName
- An event name to be associated with this increase in LTV (optional)contextInfo
- An MPProduct or any set of data to associate with this increase in LTV (optional)
-
logScreen
public void logScreen(@NonNull java.lang.String screenName)
Logs a screen view event.- Parameters:
screenName
- the name of the screen to be tracked
-
logScreen
public void logScreen(@NonNull java.lang.String screenName, @Nullable java.util.Map<java.lang.String,java.lang.String> eventData)
Logs a screen view event.- Parameters:
screenName
- the name of the screen to be trackedeventData
- a Map of data attributes to associate with this screen view
-
logScreen
public void logScreen(@NonNull java.lang.String screenName, @Nullable java.util.Map<java.lang.String,java.lang.String> eventData, @NonNull java.lang.Boolean shouldUploadEvent)
Logs a screen view event.- Parameters:
screenName
- the name of the screen to be trackedeventData
- a Map of data attributes to associate with this screen viewshouldUploadEvent
- A boolean flag that indicates whether this screen event should be uploaded to mParticle when logged or only passed to kits
-
logScreen
public void logScreen(@NonNull MPEvent screenEvent)
Logs a screen view event.- Parameters:
screenEvent
- an event object, the name of the event will be used as the screen name
-
leaveBreadcrumb
public void leaveBreadcrumb(@NonNull java.lang.String breadcrumb)
Leave a breadcrumb to be included with error and exception logging, as well as with regular session events.- Parameters:
breadcrumb
-
-
logError
public void logError(@NonNull java.lang.String message)
Logs an error event.- Parameters:
message
- the name of the error event to be tracked
-
logError
public void logError(@NonNull java.lang.String message, @Nullable java.util.Map<java.lang.String,java.lang.String> errorAttributes)
Logs an error event- Parameters:
message
- the name of the error event to be trackederrorAttributes
- a Map of data attributes to associate with this error
-
logNetworkPerformance
public void logNetworkPerformance(@NonNull java.lang.String url, long startTime, @NonNull java.lang.String method, long length, long bytesSent, long bytesReceived, @Nullable java.lang.String requestString, int responseCode)
-
logException
public void logException(@NonNull java.lang.Exception exception)
Logs an Exception.- Parameters:
exception
- an Exception
-
logException
public void logException(@NonNull java.lang.Exception exception, @Nullable java.util.Map<java.lang.String,java.lang.String> eventData)
Logs an Exception.- Parameters:
exception
- an ExceptioneventData
- a Map of data attributes
-
removeAttributionListener
public void removeAttributionListener()
Clears the current Attribution Listener.
-
getAttributionListener
@Nullable public AttributionListener getAttributionListener()
Retrieve the current Attribution Listener.
-
getAttributionResults
@NonNull public java.util.Map<java.lang.Integer,AttributionResult> getAttributionResults()
Queries the attribution results.- Returns:
- the current attribution results
-
logException
public void logException(@NonNull java.lang.Exception exception, @Nullable java.util.Map<java.lang.String,java.lang.String> eventData, @Nullable java.lang.String message)
Logs an Exception.- Parameters:
exception
- an ExceptioneventData
- a Map of data attributesmessage
- the name of the error event to be tracked
-
enableLocationTracking
public void enableLocationTracking(@NonNull java.lang.String provider, long minTime, long minDistance)
Enables location tracking given a provider and update frequency criteria. The provider must be available and the correct permissions must have been requested within your application's manifest XML file.- Parameters:
provider
- the provider keyminTime
- the minimum time (in milliseconds) to trigger an updateminDistance
- the minimum distance (in meters) to trigger an update
-
disableLocationTracking
public void disableLocationTracking()
Disables any mParticle location tracking that had been started.
-
isLocationTrackingEnabled
public boolean isLocationTrackingEnabled()
Retrieves the current setting of location tracking.
-
setLocation
public void setLocation(@Nullable android.location.Location location)
Set the current location of the active session.- Parameters:
location
-
-
setSessionAttribute
public void setSessionAttribute(@NonNull java.lang.String key, @Nullable java.lang.Object value)
Set a single session attribute. The attribute will combined with any existing session attributes.- Parameters:
key
- the attribute keyvalue
- the attribute value. This value will be converted to its String representation as dictated by itstoString()
method.
-
incrementSessionAttribute
public void incrementSessionAttribute(@NonNull java.lang.String key, int value)
Increment a single session attribute. If the attribute does not exist, it will be added as a new attribute.- Parameters:
key
- the attribute keyvalue
- the attribute value
-
getOptOut
@NonNull public java.lang.Boolean getOptOut()
Get the current opt-out status for the application.- Returns:
- the opt-out status
-
setOptOut
public void setOptOut(@NonNull java.lang.Boolean optOutStatus)
Control the opt-in/opt-out status for the application.- Parameters:
optOutStatus
- set totrue
to opt out of event tracking
-
getSurveyUrl
@Nullable public android.net.Uri getSurveyUrl(int kitId)
Retrieve a URL to be loaded within aWebView
to show the user a survey or feedback form.- Parameters:
kitId
- The ID of the desired survey/feedback service.- Returns:
- a fully-formed URI, or null if no URL exists for the given ID.
- See Also:
MParticle.ServiceProviders
-
getEnvironment
@NonNull public MParticle.Environment getEnvironment()
Get the current Environment that the SDK has interpreted. Will never return AutoDetect.- Returns:
- the current environment, either production or development
-
enableUncaughtExceptionLogging
public void enableUncaughtExceptionLogging()
Enable mParticle exception handling to automatically log events on uncaught exceptions.
-
disableUncaughtExceptionLogging
public void disableUncaughtExceptionLogging()
Disables mParticle exception handling and restores the original UncaughtExceptionHandler.
-
isAutoTrackingEnabled
@NonNull public java.lang.Boolean isAutoTrackingEnabled()
Retrieves the current setting of automatic screen tracking.- Returns:
- The current setting of automatic screen tracking.
-
getSessionTimeout
public int getSessionTimeout()
Retrieves the current session timeout setting in seconds- Returns:
- The current session timeout setting in seconds
-
getUserSegments
public void getUserSegments(long timeout, @NonNull java.lang.String endpointId, @NonNull SegmentListener listener)
-
registerWebView
public void registerWebView(@NonNull android.webkit.WebView webView)
Instrument a WebView so that communication can be facilitated between this Native SDK instance and any instance of the mParticle Javascript SDK is loaded within the provided WebView.- Parameters:
webView
-
-
registerWebView
public void registerWebView(@NonNull android.webkit.WebView webView, java.lang.String requiredBridgeName)
Instrument a WebView so that communication can be facilitated between this Native SDK instance and any instance of the mParticle Javascript SDK is loaded within the provided WebView. Additionally, the "reqiredBridgeName" value will override the generated token which is used by the Javascript SDK to ensure communication only happens across matching Workspaces. Make sure you know what you are doing when you provide a requiredBridgeName, since a mismatch with the Javascript SDK's bridgeName will result in a failure for it to forward calls to the Native SDK- Parameters:
webView
-requiredBridgeName
-
-
setLogLevel
public static void setLogLevel(@NonNull MParticle.LogLevel level)
Set the minimum log level before the SDK is initialized. The log level is used to moderate the amount of messages that are printed by the SDK to the console. Note that while the SDK is in the Production, log messages at or above this level will be printed.- Parameters:
level
-- See Also:
MParticle.LogLevel
-
Messaging
@NonNull public MPMessagingAPI Messaging()
Entry point to the Messaging APIs.- Returns:
- a helper object that allows for interaction with the Messaging APIs
-
Media
@NonNull public MPMediaAPI Media()
Entry point to the Media APIs.- Returns:
- a helper object that allows for interaction with the Media APIs
-
isProviderActive
public boolean isProviderActive(int serviceProviderId)
Deprecated.Detect whether the given service provider is active. Use this method only when you need to make direct calls to an embedded SDK. You can also register aBroadcastReceiver
with anIntentFilter
, using an action ofMParticle.ServiceProviders.BROADCAST_ACTIVE
orMParticle.ServiceProviders.BROADCAST_DISABLED
concatenated with the service provider ID:Context.registerReceiver(yourReceiver, new IntentFilter(MParticle.ServiceProviders.BROADCAST_ACTIVE + MParticle.ServiceProviders.APPBOY));
- Parameters:
serviceProviderId
-- Returns:
- True if you can safely make direct calls to the given service provider.
- See Also:
MParticle.ServiceProviders
-
isKitActive
public boolean isKitActive(int serviceProviderId)
Detect whether the given service provider kit is active. Use this method only when you need to make direct calls to an embedded SDK. You can also register aBroadcastReceiver
with anIntentFilter
, using an action ofMParticle.ServiceProviders.BROADCAST_ACTIVE
orMParticle.ServiceProviders.BROADCAST_DISABLED
concatenated with the service provider ID:Context.registerReceiver(yourReceiver, new IntentFilter(MParticle.ServiceProviders.BROADCAST_ACTIVE + MParticle.ServiceProviders.APPBOY));
- Parameters:
serviceProviderId
-- Returns:
- True if you can safely make direct calls to the given service provider.
- See Also:
MParticle.ServiceProviders
-
getKitInstance
@Nullable public java.lang.Object getKitInstance(int kitId)
Retrieve the underlying object for the given Kit Id for direct calls. Results will be null if kit is not active, or if the application just started, and the kit has not yet been initialized.- Parameters:
kitId
-- Returns:
- The Kit object, may be null if kit is not available
-
logPushRegistration
public void logPushRegistration(@Nullable java.lang.String instanceId, @Nullable java.lang.String senderId)
-
logNotification
public void logNotification(@NonNull android.content.Intent intent)
Logs a Push Notification displayed to the User.- Parameters:
intent
-
-
logNotificationOpened
public void logNotificationOpened(@NonNull android.content.Intent intent)
Logs a Push Notification has been tapped or opened.- Parameters:
intent
-
-
Internal
@NonNull public MParticle.Internal Internal()
-
Identity
@NonNull public IdentityApi Identity()
-
reset
public static void reset(@NonNull android.content.Context context)
This method will permanently remove ALL MParticle data from the device, included SharedPreferences and Database, and halt any upload or download behavior that may be in process. If you have any reference to the MParticle instance, you must remove your reference by setting it to "null", in order to avoid any unexpected behavior. The SDK will be shut down and MParticle.getInstance() will return null. MParticle can be restarted by calling MParticle.start().- Parameters:
context
-
-
reset
public static void reset(@NonNull android.content.Context context, @Nullable MParticle.ResetListener callback)
This method will permanently remove ALL MParticle data from the device, included SharedPreferences and Database, and halt any upload or download behavior that may be in process. If you have any reference to the MParticle instance, you must remove your reference by setting it to "null", in order to avoid any unexpected behavior. The SDK will be shut down and MParticle.getInstance() will return null. MParticle can be restarted by calling MParticle.start().- Parameters:
context
-callback
- A callback that will trigger when the SDK has been fully reset
-
addListener
public static void addListener(@NonNull android.content.Context context, @NonNull SdkListener listener)
NOTE: Experimental feature, adding a Listener will slow down the SDK, and should be used only for development purposes. By default, InternalListeners will automatically disable in release builds. In order to override this behavior, use the following adb shell command:`adb shell setprop debug.mparticle.listener {YOUR.PACKAGE.NAME}`
Register an instance ofSdkListener
to receive callbacks about SDK events- Parameters:
context
-listener
- the SdkListener implementation
-
removeListener
public static void removeListener(SdkListener listener)
Remove an instance ofSdkListener
.
-
setIntegrationAttributes
public void setIntegrationAttributes(int integrationId, @Nullable java.util.Map<java.lang.String,java.lang.String> attributes)
Set or remove the integration attributes for a given integration ID. Integration attributes are keys and values specific to a given integration. For example, many integrations have their own internal user/device ID. mParticle will store integration attributes for a given device, and will be able to use these values for server-to-server communication to services. This is often useful when used in combination with a server-to-server feed, allowing the feed to be enriched with the necessary integration attributes to be properly forwarded to the given integration.- Parameters:
integrationId
- mParticle integration ID. This may be aMParticle.ServiceProviders
value if it's a kit, or it could be any mParticle integration.attributes
- a map of attributes that will replace any current attributes. The keys are predefined by mParticle. Please consult with the mParticle docs or your solutions consultant for the correct value. You may also pass a null or empty map here to remove all of the attributes.
-
getIntegrationAttributes
@NonNull public java.util.Map<java.lang.String,java.lang.String> getIntegrationAttributes(int integrationId)
Queries the current integration attributes for a given integration ID. Integration attributes are keys and values specific to a given integration. For example, many integrations have their own internal user/device ID. mParticle will store integration attributes for a given device, and will be able to use these values for server-to-server communication to services. This is often useful when used in combination with a server-to-server feed, allowing the feed to be enriched with the necessary integration attributes to be properly forwarded to the given integration.- Parameters:
integrationId
- mParticle integration ID. This may be aMParticle.ServiceProviders
value if it's a kit, or it could be any mParticle integration.
-
-