Skip to content

Android SDK integration docs are wrong/outdated #7

@FrancescoRigoni

Description

@FrancescoRigoni

I was following the setup docs for session tracking on Android here
This is the suggested code for basic setup of session tracking:

import com.amplitude.android.Amplitude
import com.amplitude.android.Configuration
import com.amplitude.android.plugins.SessionReplayPlugin

// Initialize Amplitude Analytics SDK instance
val amplitude = Amplitude(Configuration(
    apiKey = API_KEY,
    context = applicationContext,
    defaultTracking = DefaultTrackingOptions(sessions = true),
))

// Create and Install Session Replay Plugin
// Recording will be handled automatically
val sessionReplayPlugin = SessionReplayPlugin(sampleRate = 1.0) 
amplitude.add(sessionReplayPlugin)

// Send replay data to the server
amplitude.flush()

However DefaultTrackingOptions has been deprecated, the correct way seems to now be

val amplitude = Amplitude(
    Configuration(
        apiKey = apiKey,
        context = context,
        serverZone = ServerZone.EU,
        autocapture = setOf(AutocaptureOption.SESSIONS)
    )
)
val sessionReplayPlugin = SessionReplayPlugin(
    sampleRate = 1.0
)
amplitude.add(sessionReplayPlugin)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions