Skip to content

setCustomerInfo() does not reliably override restored chat session data #114

@RogatinAlex

Description

@RogatinAlex

Summary

We are seeing cases where setCustomerInfo() does not seem to be fully applied to the next chat open.

For some users, the chat opens with:

  • an old groupId
  • stale customer fields
  • mixed/partially outdated customer info

This started to be reported relatively recently, but our Android integration code for opening LiveChat was not changed.

SDK version

  • com.github.livechat:chat-window-android:3.0.3

Platform

  • Android

Our integration

We set customer data immediately before opening the chat:

LiveChat.getInstance().setCustomerInfo(
    groupId = groupId,
    name = visitorName,
    email = visitorEmail,
    customParams = customParams
)

LiveChat.getInstance().show(context)

groupId and customer fields are recalculated on each open based on the current app state.

Expected behavior

The latest values passed to setCustomerInfo() should be used when the chat is opened with show().

Actual behavior

For some users, the next chat open may still use:

  • a previous groupId
  • previous customer name/email
  • previous or partially stale customParams

Important context

From the documentation, we understand that:

  • the chat view is kept in memory by default
  • the session is stored in WebView cookies
  • customer properties may require recreating the view after the chat has already loaded

However, the behavior we see is still unclear from an integration perspective:

  • setCustomerInfo() is called right before show()
  • but the resulting chat state may still reflect older data

So our main question is whether this is expected SDK/session lifecycle behavior or a bug/regression.

Reproduction scenario

A simplified scenario:

  1. Initialize SDK
  2. Call setCustomerInfo(A)
  3. Call show()
  4. Close chat
  5. Change app-side user context / language / group
  6. Call setCustomerInfo(B)
  7. Call show()

Expected:

  • chat opens with B

Observed:

  • for some users, chat may still behave as if A is active, especially for groupId and some customer fields

Possible process death scenario

We also suspect the issue may be related to Android process death after the app stays in background for some time.

A possible scenario:

  1. User opens chat with setCustomerInfo(A) and show()
  2. App goes to background
  3. Android kills the app process
  4. User returns to the app later
  5. App process is recreated
  6. We calculate fresh values and call setCustomerInfo(B) before show()
  7. Chat still appears to use old session/customer context

From our analysis, this may happen because:

  • groupId / customerInfo are stored in the SDK singleton in memory
  • after process death, that in-memory state is lost
  • but WebView session data / cookies may still persist
  • so the restored chat session may take precedence over the newly provided customer info

This makes the behavior unclear from the integration side:

  • app-side we provide fresh customer data before each show()
  • but persistent WebView session may still restore older state

Questions

Could you please clarify:

  1. Is this expected behavior of the SDK/session lifecycle, or could this be a bug/regression?
  2. Can restored WebView session/cookies override the latest setCustomerInfo() values?
  3. Is destroyLiveChatView() required every time customer data changes?
  4. Is signOutCustomer() required when changing user identity or groupId?
  5. What is the recommended way to guarantee that newly calculated groupId and customer properties are always applied after process recreation?

Additional note

We can implement a workaround on our side by explicitly calling:

  • signOutCustomer()
  • destroyLiveChatView()

But before enforcing that, we want to confirm whether this is the intended lifecycle or an issue in the SDK.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions