Package com.mixpanel.android.mpmetrics
Class MPConfig
- java.lang.Object
-
- com.mixpanel.android.mpmetrics.MPConfig
-
public class MPConfig extends java.lang.Object
Stores global configuration options for the Mixpanel library. You can enable and disable configuration options using <meta-data> tags inside of the <application> tag in your AndroidManifest.xml. All settings are optional, and default to reasonable recommended values. Most users will not have to set any options. Mixpanel understands the following options:- com.mixpanel.android.MPConfig.EnableDebugLogging
- A boolean value. If true, emit more detailed log messages. Defaults to false
- com.mixpanel.android.MPConfig.BulkUploadLimit
- An integer count of messages, the maximum number of messages to queue before an upload attempt. This value should be less than 50.
- com.mixpanel.android.MPConfig.FlushInterval
- An integer number of milliseconds, the maximum time to wait before an upload if the bulk upload limit isn't reached.
- com.mixpanel.android.MPConfig.FlushBatchSize
- Maximum number of events/updates to send in a single network request
- com.mixpanel.android.MPConfig.FlushOnBackground
- A boolean value. If false, the library will not flush the event and people queues when the app goes into the background. Defaults to true.
- com.mixpanel.android.MPConfig.DebugFlushInterval
- An integer number of milliseconds, the maximum time to wait before an upload if the bulk upload limit isn't reached in debug mode.
- com.mixpanel.android.MPConfig.DataExpiration
- An integer number of milliseconds, the maximum age of records to send to Mixpanel. Corresponds to Mixpanel's server-side limit on record age.
- com.mixpanel.android.MPConfig.MinimumDatabaseLimit
- An integer number of bytes. Mixpanel attempts to limit the size of its persistent data queue based on the storage capacity of the device, but will always allow queuing below this limit. Higher values will take up more storage even when user storage is very full.
- com.mixpanel.android.MPConfig.MaximumDatabaseLimit
- An integer number of bytes, the maximum size limit to the Mixpanel database.
- com.mixpanel.android.MPConfig.ResourcePackageName
- A string java package name. Defaults to the package name of the Application. Users should set if the package name of their R class is different from the application package name due to application id settings.
- com.mixpanel.android.MPConfig.DisableAppOpenEvent
- A boolean value. If true, do not send an "$app_open" event when the MixpanelAPI object is created for the first time. Defaults to true - the $app_open event will not be sent by default.
- com.mixpanel.android.MPConfig.DisableExceptionHandler
- A boolean value. If true, do not automatically capture app crashes. "App Crashed" events won't show up on Mixpanel. Defaults to false.
- com.mixpanel.android.MPConfig.EventsEndpoint
- A string URL. If present, the library will attempt to send events to this endpoint rather than to the default Mixpanel endpoint.
- com.mixpanel.android.MPConfig.PeopleEndpoint
- A string URL. If present, the library will attempt to send people updates to this endpoint rather than to the default Mixpanel endpoint.
- com.mixpanel.android.MPConfig.GroupsEndpoint
- A string URL. If present, the library will attempt to send group updates to this endpoint rather than to the default Mixpanel endpoint.
- com.mixpanel.android.MPConfig.MinimumSessionDuration
- An integer number. The minimum session duration (ms) that is tracked in automatic events. Defaults to 10000 (10 seconds).
- com.mixpanel.android.MPConfig.SessionTimeoutDuration
- An integer number. The maximum session duration (ms) that is tracked in automatic events. Defaults to Integer.MAX_VALUE (no maximum session duration).
- com.mixpanel.android.MPConfig.UseIpAddressForGeolocation
- A boolean value. If true, Mixpanel will automatically determine city, region and country data using the IP address of the client.Defaults to true.
- com.mixpanel.android.MPConfig.RemoveLegacyResidualFiles
- A boolean value. If true, Mixpanel will remove the residual files from legacy versions such as images produced by deprecated Messages and Experiment features. Defaults to false.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getBulkUploadLimit()
long
getDataExpiration()
boolean
getDisableAppOpenEvent()
boolean
getDisableExceptionHandler()
java.lang.String
getEventsEndpoint()
int
getFlushBatchSize()
int
getFlushInterval()
boolean
getFlushOnBackground()
java.lang.String
getGroupsEndpoint()
static MPConfig
getInstance(android.content.Context context)
int
getMaximumDatabaseLimit()
int
getMinimumDatabaseLimit()
int
getMinimumSessionDuration()
OfflineMode
getOfflineMode()
java.lang.String
getPeopleEndpoint()
boolean
getRemoveLegacyResidualFiles()
java.lang.String
getResourcePackageName()
int
getSessionTimeoutDuration()
javax.net.ssl.SSLSocketFactory
getSSLSocketFactory()
boolean
getTrackAutomaticEvents()
void
setEnableLogging(boolean enableLogging)
void
setFlushBatchSize(int flushBatchSize)
void
setMaximumDatabaseLimit(int maximumDatabaseLimit)
void
setOfflineMode(OfflineMode offlineMode)
OfflineMode
allows Mixpanel to be in-sync with client offline internal logic.void
setServerURL(java.lang.String serverURL)
void
setSSLSocketFactory(javax.net.ssl.SSLSocketFactory factory)
The MixpanelAPI will use the system default SSL socket settings under ordinary circumstances.void
setTrackAutomaticEvents(boolean trackAutomaticEvents)
void
setUseIpAddressForGeolocation(boolean useIpAddressForGeolocation)
java.lang.String
toString()
-
-
-
Field Detail
-
VERSION
public static final java.lang.String VERSION
- See Also:
- Constant Field Values
-
DEBUG
public static boolean DEBUG
-
-
Method Detail
-
getInstance
public static MPConfig getInstance(android.content.Context context)
-
setSSLSocketFactory
public void setSSLSocketFactory(javax.net.ssl.SSLSocketFactory factory)
The MixpanelAPI will use the system default SSL socket settings under ordinary circumstances. That means it will ignore settings you associated with the default SSLSocketFactory in the schema registry or in underlying HTTP libraries. If you'd prefer for Mixpanel to use your own SSL settings, you'll need to call setSSLSocketFactory early in your code, like this<pre> MPConfig.getInstance(context).setSSLSocketFactory(someCustomizedSocketFactory); </pre>
Your settings will be globally available to all Mixpanel instances, and will be used for all SSL connections in the library. The call is thread safe, but should be done before your first call to MixpanelAPI.getInstance to insure that the library never uses it's default. The given socket factory may be used from multiple threads, which is safe for the system SSLSocketFactory class, but if you pass a subclass you should ensure that it is thread-safe before passing it to Mixpanel.- Parameters:
factory
- an SSLSocketFactory that
-
setOfflineMode
public void setOfflineMode(OfflineMode offlineMode)
OfflineMode
allows Mixpanel to be in-sync with client offline internal logic. If you want to integrate your own logic with Mixpanel you'll need to callsetOfflineMode(OfflineMode)
early in your code, like this<pre> MPConfig.getInstance(context).setOfflineMode(OfflineModeImplementation); </pre>
Your settings will be globally available to all Mixpanel instances, and will be used across all the library. The call is thread safe, but should be done before your first call to MixpanelAPI.getInstance to insure that the library never uses it's default. The givenOfflineMode
may be used from multiple threads, you should ensure that your implementation is thread-safe before passing it to Mixpanel.- Parameters:
offlineMode
- client offline implementation to use on Mixpanel
-
getBulkUploadLimit
public int getBulkUploadLimit()
-
getFlushInterval
public int getFlushInterval()
-
getFlushOnBackground
public boolean getFlushOnBackground()
-
getFlushBatchSize
public int getFlushBatchSize()
-
setFlushBatchSize
public void setFlushBatchSize(int flushBatchSize)
-
getDataExpiration
public long getDataExpiration()
-
getMinimumDatabaseLimit
public int getMinimumDatabaseLimit()
-
getMaximumDatabaseLimit
public int getMaximumDatabaseLimit()
-
setMaximumDatabaseLimit
public void setMaximumDatabaseLimit(int maximumDatabaseLimit)
-
getDisableAppOpenEvent
public boolean getDisableAppOpenEvent()
-
getEventsEndpoint
public java.lang.String getEventsEndpoint()
-
getTrackAutomaticEvents
public boolean getTrackAutomaticEvents()
-
setServerURL
public void setServerURL(java.lang.String serverURL)
-
getPeopleEndpoint
public java.lang.String getPeopleEndpoint()
-
getGroupsEndpoint
public java.lang.String getGroupsEndpoint()
-
getMinimumSessionDuration
public int getMinimumSessionDuration()
-
getSessionTimeoutDuration
public int getSessionTimeoutDuration()
-
getDisableExceptionHandler
public boolean getDisableExceptionHandler()
-
getRemoveLegacyResidualFiles
public boolean getRemoveLegacyResidualFiles()
-
setUseIpAddressForGeolocation
public void setUseIpAddressForGeolocation(boolean useIpAddressForGeolocation)
-
setEnableLogging
public void setEnableLogging(boolean enableLogging)
-
setTrackAutomaticEvents
public void setTrackAutomaticEvents(boolean trackAutomaticEvents)
-
getResourcePackageName
public java.lang.String getResourcePackageName()
-
getSSLSocketFactory
public javax.net.ssl.SSLSocketFactory getSSLSocketFactory()
-
getOfflineMode
public OfflineMode getOfflineMode()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-