Class 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.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.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.DecideEndpoint
    A string URL. If present, the library will attempt to get the settings of enabling Mixpanel to automatically collect common mobile events from this url rather than the default Mixpanel endpoint.
    com.mixpanel.android.MPConfig.DisableDecideChecker
    A boolean value. If true, the library will not query our decide endpoint for the settings of enabling Mixpanel to automatically collect common mobile events. Defaults to false.
    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.
    • Field Detail

      • 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 call setOfflineMode(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 given OfflineMode 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()
      • getDataExpiration

        public long getDataExpiration()
      • getMinimumDatabaseLimit

        public int getMinimumDatabaseLimit()
      • getDisableAppOpenEvent

        public boolean getDisableAppOpenEvent()
      • getEventsEndpoint

        public java.lang.String getEventsEndpoint()
      • setServerURL

        public void setServerURL​(java.lang.String serverURL)
      • getPeopleEndpoint

        public java.lang.String getPeopleEndpoint()
      • getGroupsEndpoint

        public java.lang.String getGroupsEndpoint()
      • getDecideEndpoint

        public java.lang.String getDecideEndpoint()
      • getMinimumSessionDuration

        public int getMinimumSessionDuration()
      • getSessionTimeoutDuration

        public int getSessionTimeoutDuration()
      • getDisableExceptionHandler

        public boolean getDisableExceptionHandler()
      • getDisableDecideChecker

        public boolean getDisableDecideChecker()
      • setUseIpAddressForGeolocation

        public void setUseIpAddressForGeolocation​(boolean useIpAddressForGeolocation)
      • setEnableLogging

        public void setEnableLogging​(boolean enableLogging)
      • getResourcePackageName

        public java.lang.String getResourcePackageName()
      • getSSLSocketFactory

        public javax.net.ssl.SSLSocketFactory getSSLSocketFactory()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object