Android session replay installation
Contents
- 1
Add PostHog to your app
RequiredThe best way to install the PostHog Android library is with a build system like Gradle. This ensures you can easily upgrade to the latest versions.
All you need to do is add the
posthog-androidmodule to your App'sbuild.gradleorbuild.gradle.kts:app/build.gradleConfiguration
The best place to initialize the client is in your
Applicationsubclass.KotlinSession replay requires PostHog Android SDK version >= 3.4.0, and it's recommended to always use the latest version.
- 2
Enable session recordings in your project settings
RequiredEnable session recordings in your PostHog Project Settings.


- 3
Configure replay settings
RequiredAdd
sessionReplay = trueto your PostHog configuration alongside any of your other configuration options:Android
Limitations
- Requires Android API >= 26.
- Jetpack Compose is only supported if
screenshotis enabled. - Custom views are partly supported, and only fully supported if
screenshotis enabled. - WebView is only supported if
screenshotis enabled. A placeholder will be shown as a fallback. - Keyboard is not supported. A placeholder will be shown.
Troubleshooting
- Update your SDK.
- If you have enabled session replay using feature flags, the flags are evaluated on the device once the PostHog SDK starts as early as possible. The SDK might be using the cached flags from the previous SDK start. If you have changed the flag or its condition, kill and reopen the app to force a new SDK start at least once.
- This will also happen in production, and you might experience some delay for the new flag/conditions to take effect on your users. We're tracking this bug in issue #263.
- Session replay feature flag evaluation does not capture
$feature_flag_calledevents, so theUsagetab on the feature flag page won't show anything. We're tracking this feature request in issue #250.