crisp-im / crisp-sdk-android

:package: Crisp Android SDK, add a chat in any Android app and communicate with your users.
https://docs.crisp.chat/guides/chatbox-sdks/android-sdk/
Other
55 stars 17 forks source link

Infinite loader when calling multiple startActivity #133

Closed Doc1faux closed 1 year ago

Doc1faux commented 1 year ago

Many developers have reported infinite "Starting chat" loader when starting the ChatActivity (see screenshot below)

This was due to multiple calls to:

Intent crispIntent = new Intent(this, ChatActivity.class);
startActivity(crispIntent);

Or with 3rd-party React-Native Bridge:

CrispChatSDK.show();

Or with 3rd-party Capacitor plugin:

CrispLiveSupport.openMessenger();

Crisp Android SDK was designed to be used as a singleton, not with several instances launched at the same time as multiple calls to the above code do, resulting with only the first launched instance working, others being left in an unknown state and unfortunately, only the last launched displayed... So in order to prevent the launch of many ChatActivity instances, its launchMode has been declared as singleInstance involving any subsequent calls being ignored as long as the ChatActivity is running.