# Utility Functions

In order to facilitate your access and debugging, we provide some util API, you can choose according to the situation.

# close()

To close all AIHelp pages at one time

AIHelpSupport.close();

# enableLogging()

to enable develop logging

AIHelpSupport.enableLogging(true);

# getSDKVersion()

to get current SDK version

String sdkVersion = AIHelpSupport.getSDKVersion();

# isAIHelpShowing()

to check whether AIHelp interface is showing now

boolean isShowing = AIHelpSupport.isAIHelpShowing();

# setOnSpecificUrlClickedCallback()

To take over the click event for some specific urls with this API, you need to make some configuration as follows:

  1. Add thejs-bridge=enable to your url, such as: https://www.google.com?js-bridge=enable

  2. Register a callback to take over the click event for urls appended with js-bridge=enable:

AIHelpSupport.setOnSpecificUrlClickedCallback((url) -> {
    // url: https://www.google.com?js-bridge=enable
    // You can get the callback when user clicked the specific url
});

# setOnAIHelpSessionOpenCallback()

To register a callback for AIHelp's page opening event:

AIHelpSupport.setOnAIHelpSessionOpenCallback(() -> {
    // You can get the callback when user opened the AIHelp page
});

# setOnAIHelpSessionCloseCallback()

To register a callback for AIHelp's page closing event:

AIHelpSupport.setOnAIHelpSessionCloseCallback(() -> {
    // You can get the callback when user closed the AIHelp page
});

# setOnOperationUnreadChangedCallback()

To register a callback for operation articles' update:

AIHelpSupport.setOnOperationUnreadChangedCallback((hasUnreadArticles) -> {
    // do something you want according to the unread status received
});

# additionalSupportFor()

To provide domain support for the following country or region:

  • India
  • Mainland China

Be aware, this function should be called BEFORE init API:

if (USER_FROM_MAINLAND_CHINA) {
  AIHelpSupport.additionalSupportFor(PublishCountryOrRegion.CN);
}
AIHelpSupport.init(this, "appKey", "domain", "appId", "defaultLanguage(optional)");
Last Updated: 5/6/2023, 12:36:43 PM