From 1300a3ed037b062b492673fb9c45bb772bf6c338 Mon Sep 17 00:00:00 2001 From: dylan Date: Mon, 13 Apr 2026 13:38:15 -0700 Subject: [PATCH] fix: move getDeviceId() after enabled=true and add android to changeset getDeviceId() was being called before super.enabled = true in setup(), causing isEnabled() to return false and short-circuit the device ID initialization. Also adds posthog-android to the changeset for a proper minor version bump. --- .changeset/device-bucketing.md | 1 + posthog/src/main/java/com/posthog/PostHog.kt | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.changeset/device-bucketing.md b/.changeset/device-bucketing.md index e224592b..f90efdb0 100644 --- a/.changeset/device-bucketing.md +++ b/.changeset/device-bucketing.md @@ -1,5 +1,6 @@ --- "posthog": minor +"posthog-android": minor --- feat: add device bucketing support for stable feature flag assignment across identity changes diff --git a/posthog/src/main/java/com/posthog/PostHog.kt b/posthog/src/main/java/com/posthog/PostHog.kt index 15df15a5..ff02aba2 100644 --- a/posthog/src/main/java/com/posthog/PostHog.kt +++ b/posthog/src/main/java/com/posthog/PostHog.kt @@ -177,13 +177,13 @@ public class PostHog private constructor( legacyPreferences(config, config.serializer) + super.enabled = true + // Initialize device_id if not already set. getDeviceId() handles lazy init // by seeding from the anonymous ID, providing a stable identifier for // device-level feature flag bucketing that survives identify() and reset(). getDeviceId() - super.enabled = true - queue.start() startSession()