Android SDK - Initializing the SDK
Installation
Section titled InstallationThe following line will install the tracker and with it the SDK for you to take advantage of all tracker features.
Gradle configuration
Section titled Gradle configurationAdd it in your root build.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add the dependency in your app build.gradle file:
dependencies {
implementation("com.github.openreplay:android:v1.0.9")
}
Initialization
Section titled InitializationWhen instantiating OpenReplay’s tracker, there are several configuration options you can provide to customize many aspects of the recording and the recording experience. You must set the projectKey
option in the constructor. You can get this value from your OpenReplay dashboard under ‘Preferences > Projects’.
Adding the tracking code
Section titled Adding the tracking codeAdd the following code to your MainActivity.kt
file:
// MainActivity.kt
import com.openreplay.tracker.OpenReplay
//...
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
// not required if you're using our SaaS version
OpenReplay.serverURL = "https://your.instance.com/ingest"
// check out our SDK docs to see available options
OpenReplay.start(
applicationContext,
"projectkey",
OpenReplay.Options.defaults(),
onStarted = {
println("OpenReplay Started")
})
// ...
}
}
Sanitize Data
Section titled Sanitize DataSee how to sanitize data in Android replays for more details.
Initialization Options
Section titled Initialization Optionscrashes: Bool
Enables crashlytics.analytics: Bool
Enables analytics tracking of marked views.performances: Bool
Enables performance listener.logs: Bool
Enables logs listener.screen: Bool
Enables screen recorder.wifiOnly: Bool
Forces tracker to start only if user has a wifi connection.
Have questions?
Section titled Have questions?If you have any questions about this process, feel free to reach out to us on our Slack or check out our Forum.