This app showcases the simplest use case of the Instana Android Agent in an Android app written using:
- Kotlin
- Coroutines
- OkHttp3
This app enables crash reporting with user consent dialog. The crash generated in the example app is reported and can be seen in the dashboard .
Before generating crash a dialog box appears for user consent:
If yes is tapped then the alert box appears as shown below
Two options are available:
When generate crash button is clicked the app crashes:
After the first launch, if the app is launched again and if yes was tapped in the first launch then it will displayed as shown below
if no was tapped in the first launch then the generate crash button will be disabled as shown below
Open ExampleApp.kt and replace these two values with your own (obtained in your Instana Dashboard):
REPORTING_URL
KEY
Compile as usual using Android Studio 3.x
- Instana dependencies in project-level gradle.build
- Instana plugin and dependencies in module-level gradle.build
- Minimal initialization of Instana Agent in ExampleApp.kt
- Set view name in
onResume()
in MainActivity.kt - OkHttp3 and coroutines to execute a single query which Instana automatically tracks