[Huawei Developers] Freemind R:
AppsUP contest has been launched since June 30. Many developers meet the following issues in the process. If you also have the same issue which needs to be resolved, these questions in the list will be timely help. Any doubts or questions about Analytics Kit, this post can be a reference.

Q: When I integrate analysis kit, the compilation errors occurs in React Native Version 0.59.8

A: If you are migrating your app to HMS, suggest you to cross reference your original project and simply add the line to the buildscript/repositories and allprojects/repositories blocks.

The details you can refer:

https://forums.developer.huawei.com/forumPortal/en/topicview?tid=0201248163576960163&fid=0101187876626530001

Q: Can we change the data storage for Advanced Analytics and How?

A: Till now there is no option to change the Data Storage Location, but you can reset it by deleting your existing app and recreating the app. Then you will see the option to set data storage location option during configuring the developer option. At the same time you must be careful about setting of Data Storage Location because once it set you can't change or modify it.

Q: Huawei analysis shows that the user data does not match the user data displayed on the background of Huawei analysis.

A: According to Huawei analysis, all users are virtual users.

If an application is uninstalled and then reinstalled on a mobile phone, the number of users is counted as two.

Therefore, the number of users calculated by Huawei analysis is greater than or equal to the actual number of users.

Q: If developers need to report some customized user property, which API can be use?

A: You should use "setUserProfile" method of this class: com.huawei.hms.analytics.HiAnalyticsInstance

Attributes will be reported to AGC Analytics and will be usable.

API description is as below:

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/024/106/470/0890001000024106470.20200724080736.54763290511378695305148653182449:50510725020255:2800:18B216F5E91B7F5C6FEC1219D735A24FD14E8AFD9C9F6FD9014C353FAD8F9703.png"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/024/106/470/0890001000024106470.20200724080736.54763290511378695305148653182449:50510725020255:2800:18B216F5E91B7F5C6FEC1219D735A24FD14E8AFD9C9F6FD9014C353FAD8F9703.png[/IMG]

link:

https://developer.huawei.com/consumer/en/doc/development/HMS-References/3021008#setUserProfile

Q: How to export data to an app server through the data export API provided by the Analytics Kit gateway?

A: Before calling Analytics Kit APIs, you need to obtain the token for authentication. This process involves three parameters, wherein: client_id is the app ID obtained during app creation, client_secret is the password for the app ID that can be queried on HUAWEI Developers, grant_type has a fixed value of client_credentials. In the following example, the getToken() method sends a POST request encapsulating the HTTP tool class to obtain the token and convert the obtained token into an object for subsequent authentication.

More details, you can refer:

https://forums.developer.huawei.com/forumPortal/en/topicview?tid=0201302699264940068&fid=0101187876626530001

Q: Integrated Analytics Kit, Why Does the Server Return Error Code 402 When Data Fails to Be Reported?

A: Developers have modified the agconnect-services.json configuration. As a result, the app fails to obtain the AGC token.

Q: Where Is Entry Menu of HUAWEI Analytics Kit?

A: HUAWEI Analytics Kit has been enhanced to provide the cross-platform analysis capabilities, allowing one-stop, unified analysis of Android and iOS users. It looks into the user-centric analysis and helps you understand user behavior on the Android and iOS platforms. For easier access, the entry menu on AppGallery Connect has been changed from Analyze > Advanced analysis (beta) to My projects > HUAWEI Analytics. You can view the overall analysis report or analysis report specific to a certain platform or app in your project. You can even compare user behaviors of different apps and platforms.

Q: Why reporting of custom events fails when I was conducting cross-platform data analysis using User-ID?

A: Event ID definition rule of HUAWEI Analytics Kit: An event ID cannot be left empty or contain spaces. It can consist of a maximum of 256 characters including digits, letters, and underscores (_) but cannot start with a digit. In addition, its value cannot be the same as the ID of an automatically collected event.

Therefore, you can change Purchase Test to Purchase_Test or any other value that complies with the preceding rule.

If you have multiple iOS and Android apps in a project, you can use the filter to view the overall analysis report or detailed report of an app. You can even link users' activity data from different devices by using User-ID to obtain cross-platform analysis data. For details about cross-platform analysis, see:

https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/3021001

Q: I have integrated the iOS SDK of HUAWEI Analytics Kit into my app but why no log events are collected when the app is running?

A: When this problem occurs, it is probable that the run log parameters have not been set. You can set the log level to any of the following values: -HALogLevelDebug, -HALogLevelInfo, -HALogLevelWarn, and -HALogLevelError.

For example, to set the log level to -HALogLevelDebug, perform the following steps:

Choose Product > Scheme > Edit Scheme from the Xcode menu.

On the Arguments page, click + to add the -HALogLevelDebug parameter.

After the parameter is added, click Close to save the setting.

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/024/106/470/0890001000024106470.20200724080916.77383943736920204575598085685961:50510725020255:2800:84A448EDAB848506EAFC2950ECD5B02C214BBA7946D68EEA4B4CC5BF8F4091D2.jpg"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/024/106/470/0890001000024106470.20200724080916.77383943736920204575598085685961:50510725020255:2800:84A448EDAB848506EAFC2950ECD5B02C214BBA7946D68EEA4B4CC5BF8F4091D2.jpg[/IMG]

Q: What should I do if data reporting fails and the server returns error code 401?

A: Cause Analysis:

Possible causes are as follows:

HUAWEI Analytics Kit has not been enabled.

The obtained agconnect-services.json file is not the original file.

The debug mode has not been successfully enabled.

The Logcat log data on the device is not reported successfully.

Solution:

To correct the fault, perform the following steps:

Check whether HUAWEI Analytics Kit has been enabled and whether it has been turned on (default) in the API management.

Check whether the agconnect-services.json file is the original file without any modification.

Check whether the debug mode is enabled.

Check whether the log data is reported successfully. If the log contains resultCode: 200, the data is reported successfully. Possible causes are as follows:

Case 1: The tools:node parameter is set to "replace" (that is, tools:node="replace"). This causes the app configuration to conflict with AppGallery Connect SDK configurations, and therefore an exception occurs when the AppGallery Connect API is called to obtain the token.

Case 2: The configuration for excluding HUAWEI Analytics Kit from obfuscation is not added before you compile the APK. As a result, an exception occurs during the running of the APK.

Open the obfuscation script file of your project.

Add configurations to exclude HUAWEI Analytics Kit from obfuscation.

Set tools:node to "merge" (that is, tools:node="merge").

Manually write all information in the AndroidManifest.xml file of AppGallery Connect to the AndroidManifest.xml file of your app.

-keep class com.hianalytics.android.**{*;}

-keep class com.huawei.updatesdk.**{*;}

-keep class com.huawei.hms.**{*;}

-keep class com.huawei.agconnect.**{*;}

-keep interface com.huawei.hms.analytics.type.HAEventType{*;}

-keep interface com.huawei.hms.analytics.type.HAParamType{*;}

Related articles you can refer:

[AppsUP] Frequently Asked Questions About Huawei Account Kit

[AppsUP] Frequently Asked Questions About Huawei Map Kit

[AppsUP] Frequently Asked Questions About Huawei Push Kit

More doubts or questions about Analytics Kit, leave your comment below or ask your questions in HUAWEI Developer Forum.