Package com.mparticle

Class MParticleOptions.Builder

  • Enclosing class:
    MParticleOptions

    public static class MParticleOptions.Builder
    extends java.lang.Object
    • Method Detail

      • credentials

        @NonNull
        public MParticleOptions.Builder credentials​(@NonNull
                                                    java.lang.String apiKey,
                                                    @NonNull
                                                    java.lang.String apiSecret)
        Register an Api Key and Secret to be used for the SDK. This is a required field, and your app will not function properly if you do not provide a valid Key and Secret.
        Parameters:
        apiKey - the Api Key
        apiSecret - the Api Secret
        Returns:
        the instance of the builder, for chaining calls
      • devicePerformanceMetricsDisabled

        @NonNull
        public MParticleOptions.Builder devicePerformanceMetricsDisabled​(boolean disabled)
        Disable CPU and memory usage collection.
        Parameters:
        disabled -
        Returns:
        the instance of the builder, for chaining calls
      • androidIdDisabled

        @NonNull
        @Deprecated
        public MParticleOptions.Builder androidIdDisabled​(boolean disabled)
        Deprecated.
        This method has been replaced as the behavior has been inverted - Android ID collection is now disabled by default.

        Use androidIdEnabled(boolean) instead. 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.

        Parameters:
        disabled - false to enable collection (true by default)
        Returns:
        the instance of the builder, for chaining calls
      • androidIdEnabled

        @NonNull
        public MParticleOptions.Builder androidIdEnabled​(boolean enabled)
        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
        Parameters:
        enabled - true to enable collection (false by default)
        Returns:
        the instance of the builder, for chaining calls
      • uploadInterval

        @NonNull
        public MParticleOptions.Builder uploadInterval​(int uploadInterval)
        Set the upload interval period to control how frequently uploads occur.
        Parameters:
        uploadInterval - the number of seconds between uploads
        Returns:
        the instance of the builder, for chaining calls
      • sessionTimeout

        @NonNull
        public MParticleOptions.Builder sessionTimeout​(int sessionTimeout)
        Set the user session timeout interval.

        A session has ended once the application has been in the background for more than this timeout.
        Parameters:
        sessionTimeout - Session timeout in seconds
        Returns:
        the instance of the builder, for chaining calls
      • configMaxAgeSeconds

        @NonNull
        public MParticleOptions.Builder configMaxAgeSeconds​(int configMaxAge)
        Set a maximum threshold for stored configuration age. When the SDK starts, before we attempt to fetch a fresh config from the server, we will load the most recent previous config from disk. when configMaxAge is set, we will check the timestamp on that config and, if it's age is greater than the threshold, instead of loading it we will delete it and wait for the fresh config to arrive. This field is especially useful if your application often updates the kit/forwarding logic and has a portion of user's who experience prolonged network interruptions. In these cases, a reasonable configMaxAge will prevent those users from potentially using very forwarding logic
        Parameters:
        configMaxAge - the upper limit for config age, in seconds
        Returns:
        the instance of the builder, for chaining calls
      • enableUncaughtExceptionLogging

        @NonNull
        public MParticleOptions.Builder enableUncaughtExceptionLogging​(boolean enable)
        Enable or disable mParticle exception handling to automatically log events on uncaught exceptions.
        Returns:
        the instance of the builder, for chaining calls
      • logLevel

        @NonNull
        public MParticleOptions.Builder logLevel​(@NonNull
                                                 MParticle.LogLevel logLevel)
        Set the minimum log level for the SDK. 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:
        logLevel - the preferred level of logging
        Returns:
        the instance of the builder, for chaining calls
        See Also:
        MParticle.LogLevel
      • attributionListener

        @NonNull
        public MParticleOptions.Builder attributionListener​(@Nullable
                                                            AttributionListener attributionListener)
        Register a callback for when an attribution is received.
        Parameters:
        attributionListener - an instance of the AttributionListener callback
        Returns:
        the instance of the builder, for chaining calls
        See Also:
        AttributionListener
      • locationTrackingDisabled

        @NonNull
        public MParticleOptions.Builder locationTrackingDisabled()
        Disables Location tracking.
        Returns:
        the instance of the builder, for chaining calls
      • locationTrackingEnabled

        @NonNull
        public MParticleOptions.Builder locationTrackingEnabled​(@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 key
        minTime - the minimum time (in milliseconds) to trigger an update
        minDistance - the minimum distance (in meters) to trigger an update
        Returns:
        the instance of the builder, for chaining calls
      • pushRegistration

        @NonNull
        public MParticleOptions.Builder pushRegistration​(@NonNull
                                                         java.lang.String instanceId,
                                                         @NonNull
                                                         java.lang.String senderId)
        Manually log a push registration.
        Parameters:
        instanceId - the Instance Id of the push token
        senderId - the Sender Id of the push token
        Returns:
        the instance of the builder, for chaining calls
      • identityConnectionTimeout

        @NonNull
        public MParticleOptions.Builder identityConnectionTimeout​(int identityConnectionTimeout)
        Set the user connection timeout interval.

        A connection to the server closes after this timeout expires, for each call.
        Parameters:
        identityConnectionTimeout - the connection timeout for Identity server calls, in seconds
        Returns:
        the instance of the builder, for chaining calls
      • dataplan

        @NonNull
        public MParticleOptions.Builder dataplan​(@Nullable
                                                 java.lang.String dataplanId,
                                                 @Nullable
                                                 java.lang.Integer dataplanVersion)
      • dataplanOptions

        @NonNull
        public MParticleOptions.Builder dataplanOptions​(MParticleOptions.DataplanOptions dataplanOptions)
        Set the MParticleOptions.DataplanOptions. This object is used to load a dataplan for the purpose of blocking unplanned attributes and/or events from being forwarded to kit integrations. When set, this will override any block settings that have been configured in the mParticle dashboard.
        Parameters:
        dataplanOptions -
        Returns:
      • build

        @NonNull
        public MParticleOptions build()
        Builds this Builder into an MParticleOptions object which can be used to start the SDK.
        Returns:
        MParticleOptions instance