Copilot SDK UI Reference
1. Integration Guide
1.1 Requirements
- Android SDK Version: 
API Level 23or above - Gradle Version: 
7.4.2or above 
1.2 Quick Integration
Required Dependencies
- 1.Integrate Thingsmart
 - 2.Integrate IPCSDK
 - Add Copilot SDK API dependencies in your 
build.gradlefile. 
dependencies {
    implementation 'com.thingclips.smart:thingsmart-ipcsdk:2.0.0-cube.5'
    implementation 'com.thingclips.smart:thingsmart:2.1.0-cube'
    implementation("com.thing.solution:copilot-ui:1.0.0-cube-starsg.3") {
        exclude group: 'com.thingclips.smart', module: 'thingsmart-thinghomesdk'
    }
    implementation 'com.thingclips.smart:react-native:4.9.11'
    implementation 'com.thingclips.smart:thingsmart-imagepipeline-okhttp3:2.0.0-cube.5'
}
configurations.all {
    resolutionStrategy {
        force 'com.thingclips.android.module:thingmodule-annotation:4.6.0-rc.1'
        force 'com.thingclips.smart:thingsmart-ipcsdk:2.0.0-cube.5'
        force 'com.thingclips.smart:thingsmart-imagepipeline-okhttp3:2.0.0-cube.5'
    }
}
1.3 Initialize SDK
public class MyApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        ThingHomeSdk.init(this, "appKey", "AppScreat")
        //Set base request host
        FrescoManager.initFresco(this)
        CopilotSdk.setHost("https://api.starsg.com/api.json")
        CopilotSdk.setH5Host("xxxx")
    }
}
class MyActivity : BaseActivity() {
      override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        HomeInfoManager.setCurrentHomeId(homeId)
    }
}
2. Page Navigation APIs
2.1 Copilot Related Pages
2.1.1 Get Copilot List Page
Method Name:
fun getCopilotListPage(): AiCopilotListFragment
Return Value:
- Returns 
AiCopilotListFragmentinstance. 
Example
    var copilotListFragment: AiCopilotListFragment = CopilotPageManager.getCopilotListPage()
2.1.2 Navigate to Copilot List Page
Method Name:
fun navigateToCopilotList(context: Context)
Parameters:
context: Context
Return Value:
- None.
 
Example
    CopilotPageManager.navigateToCopilotList(this)
2.2 Product Related Pages
2.2.1 Get Products List Page
Method Name:
fun getProductListPage(): AiServiceListFragment
Return Value:
- Returns 
AiServiceListFragmentinstance. 
Example
    CopilotPageManager.getProductListPage()
2.2.2 Get Product Order List Page
Method Name:
fun navigateToProductOrders(context: Context)
Parameters:
context: Context
Return Value:
- None
 
Example
    CopilotPageManager.navigateToProductOrders(this)
2.2.3 Navigate to Product Web Page Detail
Method Name:
fun navigateToProductDetail(context: Context, isPurchased: Boolean, id: String, serviceType: Int?, aiType: String?, uiType: String?, instanceType: String?, instanceId: String?, serviceStatus: Int? , copilotId: String? , copilotSrc: String? , copilotVersion: String?)
Parameters:
context: Contextid: For purchased products pass orderNo, for unpurchased pass product IDisPurchased: Whether the product is purchasedserviceType: Service type (optional)aiType: AI type (optional)uiType: UI type (optional)instanceType: Instance type (optional)instanceId: Instance ID (optional)serviceStatus: Service status (optional)copilotId: Copilot ID (optional)copilotSrc: Copilot source (optional)copilotVersion: Copilot version (optional)
Return Value:
- No return value.
 
Usage Example:
CopilotPageManager.navigateToProductDetail(
    context = this,
    isPurchased = true,
    id = "product123",
    serviceType = 1,
    aiType = "Chat Bot",
    uiType = "General",
    instanceType = "0",
    instanceId = "device123",
    serviceStatus = 1,
    copilotId = "copilot123",
    copilotSrc = "source",
    copilotVersion = "1.0"
)
2.2.4 Navigate to Purchased Products Page
Method Name:
fun navigateToPurchasedProducts(context: Context)
Parameters:
context: Context
Return Value:
- None.
 
Example
    CopilotPageManager.navigateToPurchasedProducts(this)
2.3 Message-related Pages
2.3.1 Get Message List Page
Method Name:
fun getMessageListFragment(type: Int, title: String): AiMessageFragment
Parameter Description:
type: Type 20 for individual messages, 30 for group messagestitle: Title name
Return Value:
- Returns an instance of 
AiMessageFragment. 
Usage Example
    var copilotListFragment: AiMessageFragment = CopilotPageManager.getMessageListFragment(2, "ai")