The sample code provides a demo project that demonstrates how to call open APIs of Analytics Kit. Guided by the demo, you will learn how to:
- Efficiently integrate Analytics Kit.
- Correctly use APIs of Analytics Kit.
You can use the sample code only after completing the following operations:
- Download the demo project used in the codelab, obtain the Analytics.js file, and place the file in the assets/Script directory. Do not import Analytics.js as a plugin.
- Bind the Analytics.js file to the root objects (usually the Canvas objects) of all scene files.
- Sign in to AppGallery Connect, click My projects, and find the app that needs to integrate the SDK. Then go to the Project settings page, and download the agconnect-services.json file. Assign the file content to the aGConnectServicesConfig variable in the Analytics.js file to complete SDK initialization.
Start the demo project.
- Connect your phone to your computer and ensure that your phone is in debug mode.
- Go to Project > Build....
- To release a runtime quick game, perform the following operations:
- In the Build... dialog box displayed, set Platform to Huawei Quick Game and click Build. After the build is complete, click Play.
- In the QuickGame Devtools dialog box displayed, click ▶ to run the project.
- To release an HTML5 quick game, perform the following operations:
- In the Build... dialog box displayed, set Platform to Web Mobile and click Build. After the build is complete, click Play.
- After a successful startup, use Quick App IDE to open and run the HTML5 quick game project.
- Refer to the precautions for using SSL certificates to deal with the SSL error.
- After a successful startup, you will see a demo with the question answering function on the phone.