crisp-sdk-android
crisp-sdk-android copied to clipboard
How do I know if it has been initialized?
How do I know if it has been initialized?
I wish i can use like the Crisp.isInitialized()
to get
Can you explain what you are trying to do?
Baptiste Jamin
On 13 Sep 2022, at 14:38, SunSeekerX @.***> wrote:
I wish i can use like the Crisp.isInitialized() to get
— Reply to this email directly, view it on GitHub https://github.com/crisp-im/crisp-sdk-android/issues/138#issuecomment-1245352954, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGTRQ3TXIKACPR2QWW3ZHLV6BYSRANCNFSM6AAAAAAQLMVMGQ. You are receiving this because you are subscribed to this thread.
Thank you for such a quick reply!
The websiteID is required to start the crisp activity interface, if not I get an error java.lang.AssertionError: Crisp ChatBox SDK has not been configured yet. Please make sure to call Crisp.configure(String websiteID) first!
, so I want to know if I have set the websiteID.
Answer is very simple. Did you follow the docs ? Just add a Log.d after setting the website ID. If you see the log, then you settled the site ID…Sent from my iPhoneOn 13 Sep 2022, at 14:49, SunSeekerX @.***> wrote: Thank you for such a quick reply! The websiteID is required to start the crisp activity interface, if not I get an error java.lang.AssertionError: Crisp ChatBox SDK has not been configured yet. Please make sure to call Crisp.configure(String websiteID) first!, so I want to know if I have set the websiteID.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>
This error came after I entered the crisp interface, and I had no way to catch it, so I needed to do a determination of whether it was initialized before I entered the crisp interface.
Answer is very simple. Did you follow the docs ? Just add a Log.d after setting the website ID. If you see the log, then you settled the site ID…Sent from my iPhoneOn 13 Sep 2022, at 14:49, SunSeekerX @.> wrote: Thank you for such a quick reply! The websiteID is required to start the crisp activity interface, if not I get an error java.lang.AssertionError: Crisp ChatBox SDK has not been configured yet. Please make sure to call Crisp.configure(String websiteID) first!, so I want to know if I have set the websiteID. —Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.>
Sure, but the websiteId is passed in externally.
My requirement is to know if I have set the websiteId before starting crisp, and I need to use if to determine this, rather than outputting a log
Externally ?Sent from my iPhoneOn 13 Sep 2022, at 14:55, SunSeekerX @.***> wrote:
Answer is very simple. Did you follow the docs ? Just add a Log.d after setting the website ID. If you see the log, then you settled the site ID…Sent from my iPhoneOn 13 Sep 2022, at 14:49, SunSeekerX @.> wrote: Thank you for such a quick reply! The websiteID is required to start the crisp activity interface, if not I get an error java.lang.AssertionError: Crisp ChatBox SDK has not been configured yet. Please make sure to call Crisp.configure(String websiteID) first!, so I want to know if I have set the websiteID. —Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.>
Sure, but the websiteId is passed in externally.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>
Take look this
if(Crisp.isInitialized()){
Intent crispIntent = new Intent(mUniSDKInstance.getContext(), ChatActivity.class);
mUniSDKInstance.getContext().startActivity(crispIntent);
result.put("success", true);
result.put("code", 200);
result.put("msg", "启动成功!");
} else {
return "Please set websiteId first!";
}
Hi @SunSeekerX.
As soon as the Crisp.configure(Context applicationContext, String websiteID)
returns, SDK is initialized with your new websiteID
, except in a specific case where chatbox is already running where we wait until the chatbox is closed...
So in your sample code, you could just make a call to Crisp.configure(Context applicationContext, String websiteID)
before starting the ChatActivity
.
For the moment, there is no public API available to know if Crisp is initialized.
Okay, thanks for the answer, but I still need a way to know if it's initialized or not to optimize the code logic.