# Upgrade Guide

Version 5.x introduces significant improvements in data security and implements enhanced security policies, along with several API adjustments from previous versions.

To ensure a smooth upgrade process, we have outlined the key changes and explanations below.

# Initialization

Starting from version 5.x, the SDK initialization method has been updated as follows:

  • The initialization method has been changed from init to initialize
  • appKey has been removed from the parameter list; only domain and appId are required, with language remaining optional
AIHelpSupport.initialize(this,
        "THIS IS YOUR APP DOMAIN",
        "THIS IS YOUR APP ID",
        "THIS IS YOUR DEFAULT LANGUAGE(OPTIONAL)");

For more details, please refer to Quick Start (opens new window).

# Event Callbacks

Version 5.x replaces the previous callback listeners with an event broadcast system to handle all callback scenarios uniformly.

For example, instead of using setOnAIHelpInitializedCallback for initialization callbacks, you now register event listeners using the registerAsyncEventListener method:


 
 
 
 
 
 

AIHelpSupport.initialize(/** your code here */);
AIHelpSupport.registerAsyncEventListener(YOUR_EVENT, new AsyncEventListener() {
    @Override
    public void onAsyncEventReceived(String jsonEventData, Acknowledgment ack) {
        // You can get callback here if the target event is fired
    }
});

We broadcast certain events, and you can subscribe to relevant events to handle specific logic.

For more details, please refer to Event Broadcasting (opens new window).

# User Identity

Version 5.x includes changes to user identity verification:

  • Added the login API for passing userId and other user information to AIHelp
  • The existing updateUserInfo API no longer accepts the userId parameter and is now primarily used for updating user information

For more details, please refer to User Identity (opens new window).

# Unread Message Notifications

Version 5.x introduces changes to unread message notification handling:

  • Removed the previous polling mechanism for unread messages and added the fetchUnreadMessageCount API for real-time unread count retrieval
  • Unread message counts are now broadcast as events, requiring developers to subscribe to relevant events
  • The API implements a five-minute cache, returning the previous request result for repeated calls within this period

Based on our experience, polling is generally unnecessary. We recommend calling the API when switching pages or scenes for real-time queries, which is more resource-efficient.

For more details, please refer to Unread Message Notifications (opens new window).

# Others

Due to API changes in this upgrade, engine-based integrations require updated bridge files.

For Cocos2dx engines, manually replace the bridge files with the new version. For Unity engines, simply re-import the package.

For more details, please refer to:

Last Updated: 11/30/2024, 11:18:33 AM