diff --git a/USAGE.md b/USAGE.md index 196fc180..e42e9b45 100644 --- a/USAGE.md +++ b/USAGE.md @@ -218,6 +218,8 @@ val config = PostHogAndroidConfig(apiKey).apply { sessionReplayConfig.screenshot = false // debouncerDelayMs is 500ms by default sessionReplayConfig.debouncerDelayMs = 1000 + // minSessionDurationMs is 1000ms by default + sessionReplayConfig.minSessionDurationMs = 2000 } ``` diff --git a/posthog-android/src/main/java/com/posthog/android/replay/PostHogSessionReplayConfig.kt b/posthog-android/src/main/java/com/posthog/android/replay/PostHogSessionReplayConfig.kt index a94ea35f..5111c2f9 100644 --- a/posthog-android/src/main/java/com/posthog/android/replay/PostHogSessionReplayConfig.kt +++ b/posthog-android/src/main/java/com/posthog/android/replay/PostHogSessionReplayConfig.kt @@ -4,48 +4,55 @@ import com.posthog.PostHogExperimental @PostHogExperimental public class PostHogSessionReplayConfig - @JvmOverloads - constructor( - /** - * Enable masking of all text input fields - * Defaults to true - * This isn't supported if using Jetpack Compose views, use with caution - */ - @PostHogExperimental - public var maskAllTextInputs: Boolean = true, - /** - * Enable masking of all images to a placeholder - * Defaults to true - * This isn't supported if using Jetpack Compose views, use with caution - */ - @PostHogExperimental - public var maskAllImages: Boolean = true, - /** - * Enable capturing of logcat as console events - * Defaults to true - */ - @PostHogExperimental - public var captureLogcat: Boolean = true, - /** - * Converts custom Drawable to Bitmap - * By default PostHog tries to convert the Drawable to Bitmap, the supported types are - * BitmapDrawable, ColorDrawable, GradientDrawable, InsetDrawable, LayerDrawable, RippleDrawable - */ - @PostHogExperimental - public var drawableConverter: PostHogDrawableConverter? = null, - /** - * By default Session replay will capture all the views on the screen as a wireframe, - * By enabling this option, PostHog will capture the screenshot of the screen. - * The screenshot may contain sensitive information, use with caution. - */ - @PostHogExperimental - public var screenshot: Boolean = false, - /** - * Deboucer delay used to reduce the number of snapshots captured and reduce performance impact - * This is used for capturing the view as a wireframe or screenshot - * The lower the number more snapshots will be captured but higher the performance impact - * Defaults to 500ms - */ - @PostHogExperimental - public var debouncerDelayMs: Long = 500, - ) +@JvmOverloads +constructor( + /** + * Enable masking of all text input fields + * Defaults to true + * This isn't supported if using Jetpack Compose views, use with caution + */ + @PostHogExperimental + public var maskAllTextInputs: Boolean = true, + /** + * Enable masking of all images to a placeholder + * Defaults to true + * This isn't supported if using Jetpack Compose views, use with caution + */ + @PostHogExperimental + public var maskAllImages: Boolean = true, + /** + * Enable capturing of logcat as console events + * Defaults to true + */ + @PostHogExperimental + public var captureLogcat: Boolean = true, + /** + * Converts custom Drawable to Bitmap + * By default PostHog tries to convert the Drawable to Bitmap, the supported types are + * BitmapDrawable, ColorDrawable, GradientDrawable, InsetDrawable, LayerDrawable, RippleDrawable + */ + @PostHogExperimental + public var drawableConverter: PostHogDrawableConverter? = null, + /** + * By default Session replay will capture all the views on the screen as a wireframe, + * By enabling this option, PostHog will capture the screenshot of the screen. + * The screenshot may contain sensitive information, use with caution. + */ + @PostHogExperimental + public var screenshot: Boolean = false, + /** + * Deboucer delay used to reduce the number of snapshots captured and reduce performance impact + * This is used for capturing the view as a wireframe or screenshot + * The lower the number more snapshots will be captured but higher the performance impact + * Defaults to 500ms + */ + @PostHogExperimental + public var debouncerDelayMs: Long = 500, + /** + * Define the minimum duration for sessions to be recorded. + * This is useful if you want to exclude sessions that are too short to be useful. + * Defaults to 1000ms + */ + @PostHogExperimental + public var minSessionDurationMs: Long = 1000, +) diff --git a/posthog-samples/posthog-android-sample/src/main/java/com/posthog/android/sample/MyApp.kt b/posthog-samples/posthog-android-sample/src/main/java/com/posthog/android/sample/MyApp.kt index 7f3d3798..63f85048 100644 --- a/posthog-samples/posthog-android-sample/src/main/java/com/posthog/android/sample/MyApp.kt +++ b/posthog-samples/posthog-android-sample/src/main/java/com/posthog/android/sample/MyApp.kt @@ -40,6 +40,7 @@ class MyApp : Application() { sessionReplayConfig.maskAllImages = false sessionReplayConfig.captureLogcat = true sessionReplayConfig.screenshot = true + sessionReplayConfig.minSessionDurationMs = 2000 } PostHogAndroid.setup(this, config) }