mixpanel / mixpanel-android

Official Android Tracking Library for Mixpanel Analytics
http://mixpanel.com/
Apache License 2.0
1.02k stars 366 forks source link

add APIs 'setFlushBatchSize' and 'setMaximumDatabaseLimit' #795

Closed zihejia closed 2 years ago

zihejia commented 2 years ago

This PR adds the following new configs for you to optimize the Mixpanel tracking:

     * Set maximum number of events/updates to send in a single network request
     *
     * @param flushBatchSize  int, the number of events to be flushed at a time, defaults to 50
     */
    public void setFlushBatchSize(int flushBatchSize);

    /**
     * Set an integer number of bytes, the maximum size limit to the Mixpanel database.
     *
     * @param maximumDatabaseLimit an integer number of bytes, the maximum size limit to the Mixpanel database.
     */
    public void setMaximumDatabaseLimit(int maximumDatabaseLimit);

You can also set them in AndroidManifest.xml, i.e.

        <meta-data android:name="com.mixpanel.android.MPConfig.FlushBatchSize"
            android:value="5" />

        <meta-data android:name="com.mixpanel.android.MPConfig.MaximumDatabaseLimit"
            android:value="100000000" />