[Huawei Developers] Mike-mei:
How do I know whether the Analytics SDK has been successfully integrated or reported data? What is the meaning of key log content?​

1. Add the following code to enable the logging function before initializing the Analytics SDK:

HiAnalyticsTools.enableLog ();

2. Add the following code to initialize the Analytics SDK:

HiAnalyticsInstance instance = HiAnalytics.getInstance (this);

3. Run the app and check whether data has been successfully reported based on the log content.

If the Analytics SDK fails to be integrated or report data:

An error code will be contained in the log, and some log content may be marked in red. Check whether related solutions are available by referring to Result Codes and Integration and Debugging.

If data is successfully reported, the key log content is as follows:

HiAnalyticsSDK: SendMission=> events PostRequest sendevent TYPE : oper, TAG : _openness_config_tag, resultCode: 200 ,reqID:xxx

In app debug mode, each time data is reported, the following log content is generated:

HiAnalyticsSDK: DeviceToolsKit=> debugMode enabled.

In app debug mode, if an event cannot be reported, the following log content is generated:

HiAnalyticsSDK: ReportRingback=> do not enable APIEvt in debug model

What can I do if the error message "client token request miss client id" is displayed during SDK initialization?​

​

[Error message]​

HiAnalyticsSDK: TokenAssignment=> SE-003|get token exception on the AGC! java.lang.IllegalArgumentException: client token request miss client id, please check whether the 'agconnect-services.json' is configured correctly

[Root cause]​

The Do not include key switch next to agconnect-services.json in the App information area on the Project settings page is toggled on. As a result, keys including the client key and API key are excluded from the configuration file, but APIs of the AppGallery Connect SDK have not been called to manually configure the key information.

View attachment 5843787

[Solution]​

If you have enabled Do not include key before downloading the agconnect-services.json file, call APIs of the AppGallery Connect SDK to manually configure the key information. For details, please refer to Setting Parameters Using the Configuration File.

3. What can I do if CE-001 or SE-001 is reported during SDK initialization?​

[Error message]​

HiAnalyticsSDK: jsonParses=> CE-001|Cannot find productId from agconnect-services.json
HiAnalyticsSDK: InitTask=> SE-001|_openness_config_tag instance config init failed!. param error config params is error

[Root cause]​

The parameters for integrating the SDK are incorrect due to the following reasons:

The agconnect-services.json file is saved in the incorrect path.

Content in the agconnect-services.json file is incomplete, or productId has been modified.

In the app-level build.gradle file, apply plugin: 'com.huawei.agconnect' has not been added, or id 'com.huawei.agconnect' has not been added to plugins.

Note: Add com.huawei.agconnect below com.android.application. Otherwise, an error will be reported.

[Solution]​

Place the agconnect-services.json file in the correct path.

Download the agconnect-services.json file from AppGallery Connect again and use it to replace the original one.

Add the com.huawei.agconnect configuration in the correct place.

You can check the configuration by referring to Integrating the SDK.

Learn more​

Official website of Analytics Kit

Development guide of Analytics Kit