Sur cette page

Android

The Kotlin Android SDK lets you send events to Amplitude.

Configure the SDK

Configure batching behavior

To support high-performance environments, the SDK sends events in batches. The SDK queues every event that the track method logs in memory, then flushes events in batches in the background. To customize batch behavior, set flushQueueSize and flushIntervalMillis. By default, serverUrl is https://api2.amplitude.com/2/httpapi. To send large batches of data at a time, set useBatch to true. Setting useBatch to true directs setServerUrl to the batch event upload API at https://api2.amplitude.com/batch. Both regular mode and batch mode use the same event upload threshold and flush time intervals.

kotlin
import com.amplitude.android.Amplitude

val amplitude = Amplitude(
 Configuration(
 apiKey = AMPLITUDE_API_KEY,
 context = applicationContext,
 flushIntervalMillis = 50000,
 flushQueueSize = 20,
 )
)

Was this helpful?