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

1

Add the dependency

Add the tracker dependency to the app module.

app/build.gradle.kts

1dependencies {2  implementation("io.grometrics:grometrics-android:1.0.0")3}
2

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() {2  override fun onCreate() {3    super.onCreate()4    Grometrics.configure(this, websiteId = "YOUR_SITE_ID")5    Grometrics.appOpen()6  }7}
3

Track screens

Send a screen view from Activity, Fragment, or Compose destination changes.

CheckoutScreen.kt

1Grometrics.screenView(2  name = "Checkout",3  screenClass = "Checkout"4)

Options / Configuration

OptionTypeRequiredDescription
websiteIdstringYour Grometrics site ID
appVersionstringnoPopulates app version filters
debugbooleannoLogs 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?