Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I know if it has been initialized? #138

Open
SunSeekerX opened this issue Sep 13, 2022 · 11 comments
Open

How do I know if it has been initialized? #138

SunSeekerX opened this issue Sep 13, 2022 · 11 comments

Comments

@SunSeekerX
Copy link

How do I know if it has been initialized?

@SunSeekerX
Copy link
Author

I wish i can use like the Crisp.isInitialized() to get

@baptistejamin
Copy link
Member

baptistejamin commented Sep 13, 2022 via email

@SunSeekerX
Copy link
Author

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.

@baptistejamin
Copy link
Member

baptistejamin commented Sep 13, 2022 via email

@SunSeekerX
Copy link
Author

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.

@SunSeekerX
Copy link
Author

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.

@SunSeekerX
Copy link
Author

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

@baptistejamin
Copy link
Member

baptistejamin commented Sep 13, 2022 via email

@SunSeekerX
Copy link
Author

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!";
    }

@Doc1faux
Copy link
Collaborator

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.

@SunSeekerX
Copy link
Author

Okay, thanks for the answer, but I still need a way to know if it's initialized or not to optimize the code logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants