Android (Kotlin)
Install the Android SDK and track app opens and screens.
Last updated June 3, 2026
Install the Android SDK, configure the site ID, and send app_open and screen_view events. Lifecycle events can be sent explicitly with trackEvent from Activity callbacks. See what the SDK can do →.
Prerequisites
- A Grometrics site ID from Settings > Tracking
- Access to the mobile app code
- A debug build or simulator for verification
Steps
Add version 1.1.1
Add the tracker dependency to the app module.
app/build.gradle.kts
1dependencies {2implementation("com.usegrometrics:grometrics-android:1.1.1")3}
Create and start the tracker
Keep one tracker instance in your Application or dependency container.
Replace YOUR_SITE_ID with your site ID from Settings > Tracking.
MainApplication.kt
1val grometrics = GrometricsTracker(2applicationContext,3GrometricsConfiguration(websiteId = "YOUR_SITE_ID")4)5grometrics.start()
Identify and reset
Identify after login and reset before another user can sign in on the device.
Auth.kt
1grometrics.identify(user.id)23// Before sign-out4grometrics.reset()5auth.signOut()
Track screens
Send a screen view from Activity, Fragment, or Compose destination changes.
CheckoutScreen.kt
1grometrics.trackScreen(2name = "Checkout",3path = "/checkout"4)
Options / Configuration
| Option | Type | Required | Description |
|---|---|---|---|
| websiteId | string | ✓ | Your Grometrics site ID |
| appVersion | string | no | Populates app version filters |
What happens next
Run a debug build and confirm app_open and screen_view 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?