Android (Kotlin)
Install the Android SDK and send app lifecycle events.
Last updated June 3, 2026
Install the Android SDK, configure the site ID, and send app_open, screen_view, and app_background events.
Prerequisites
- A Grometrics site ID from Settings > Tracking
- Access to the mobile app code
- A debug build or simulator for verification
Steps
Add the dependency
Add the tracker dependency to the app module.
app/build.gradle.kts
1dependencies {2implementation("io.grometrics:grometrics-android:1.0.0")3}
Configure in Application
Start the tracker when the app process starts.
Replace YOUR_SITE_ID with your site ID from Settings > Tracking.
MainApplication.kt
1class MainApplication : Application() {2override fun onCreate() {3super.onCreate()4Grometrics.configure(this, websiteId = "YOUR_SITE_ID")5Grometrics.appOpen()6}7}
Track screens
Send a screen view from Activity, Fragment, or Compose destination changes.
CheckoutScreen.kt
1Grometrics.screenView(2name = "Checkout",3screenClass = "Checkout"4)
Options / Configuration
| Option | Type | Required | Description |
|---|---|---|---|
| websiteId | string | ✓ | Your Grometrics site ID |
| appVersion | string | no | Populates app version filters |
| debug | boolean | no | Logs setup events in development |
What happens next
Run a debug build and confirm lifecycle and screen events in Realtime.
Verify your setup
Verify your setup
Troubleshooting
No event appears
Confirm the site ID matches Settings > Tracking and that the latest published code is running.
Was this page helpful?