Symptom:
When the getRankingIntent API is called, which is related to leaderboards, the following error message is displayed.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Log Information
The following error information is displayed in the Android Studio Logcat logs:
HTML:
2020-10-22 11:14:17.831 27218-3850/com.huawei.gameassistant W/HwGameAssistant-10.6.0.301-RequestHelper: client.assistant.gs.leaderboard.scores reponse fail code:502, msg:Bad Gateway
2020-10-22 11:14:17.831 27218-3850/com.huawei.gameassistant E/HwGameAssistant-10.6.0.301-GameRankingScoreListViewModel: getHttpStatusCode is : 502
Troubleshooting
The test result shows that the game sign-in function is normal. Therefore, the problem is not caused by a network error. After studying relevant documents, we checked the following items:
1. First, we ensured that the package name and app ID belong to the same game.
2. Then, we checked whether leaderboards have been created for the game in HUAWEI AppGallery Connect. It was found that leaderboards have been added for another game. We attempted to resolve the problem. However, testing shows that the problem still persists.
3. Finally, it was found that the account we used for testing is not on the list of test accounts in AppGallery Connect. After adding it to the list and clearing HMS Core (APK) cache on the phone, the problem is solved.
Summary:
If you find that the leaderboard function is abnormal, ensure that:
The app ID and the package name belong to the same game.
Your game has its leaderboard data created in AppGallery Connect.
Your test account has been added in AppGallery Connect.
For more details, check:
Adding a Leaderboard:
https://developer.huawei.com/consumer/en/doc/distribution/app/agc-add_leaderboard
Managing Tester Accounts:
https://developer.huawei.com/consumer/en/doc/distribution/app/agc-tester_account_mgt
Related
Recently, a developer needed to access HUAWEI AppGallery Connect API and create a product through the PMS API (server API). However, when Postman was used for basic service interconnection tests, the error message "403 client token authorization fail" was displayed.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
They checked the error code description and found that the error was caused by an authentication failure.
1. To solve the problem, they first confirmed that the client ID used for applying for the token had sufficient permission.
2. The official document suggested that the project associated with the API client be selected as N/A. They created an API client and associated it with a project. An app ID in this project was 100xxx591. However, the app ID in the Postman service request was 101xxx531, which might have caused the authentication failure.
3. To verify the assumption, they created an API client and selected N/A (indicating that all projects are supported) and used the client to request a token. The process then went well.
To draw a conclusion, If Huawei's 403 authentication failure occurs, you can verify the permission first, and then check the associated projects.
Reference:
For details about the PMS API, please refer to:
https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agcapi-addproduct
For more details, you can go to:
Official website
Development Documentation page, to find the documents you need
Reddit to join our developer discussion
GitHub to download demos and sample codes
Stack Overflow to solve any integration problems
Symptom:
When the getRankingIntent API is called, which is related to leaderboards, the following error message is displayed.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Log Information
The following error information is displayed in the Android Studio Logcat logs:
2020-10-22 11:14:17.831 27218-3850/com.huawei.gameassistant W/HwGameAssistant-10.6.0.301-RequestHelper: client.assistant.gs.leaderboard.scores reponse fail code:502, msg:Bad Gateway
2020-10-22 11:14:17.831 27218-3850/com.huawei.gameassistant E/HwGameAssistant-10.6.0.301-GameRankingScoreListViewModel: getHttpStatusCode is : 502
Troubleshooting
The test result shows that the game sign-in function is normal. Therefore, the problem is not caused by a network error. After studying relevant documents, we checked the following items:
1. First, we ensured that the package name and app ID belong to the same game.
2. Then, we checked whether leaderboards have been created for the game in HUAWEI AppGallery Connect. It was found that leaderboards have been added for another game. We attempted to resolve the problem. However, testing shows that the problem still persists.
3. Finally, it was found that the account we used for testing is not on the list of test accounts in AppGallery Connect. After adding it to the list and clearing HMS Core (APK) cache on the phone, the problem is solved.
Summary:
If you find that the leaderboard function is abnormal, ensure that:
The app ID and the package name belong to the same game.
Your game has its leaderboard data created in AppGallery Connect.
Your test account has been added in AppGallery Connect.
For more details, check:
Adding a Leaderboard:
https://developer.huawei.com/consumer/en/doc/distribution/app/agc-add_leaderboard
Managing Tester Accounts:
https://developer.huawei.com/consumer/en/doc/distribution/app/agc-tester_account_mgt
The Content of part1 is here.
Generating and Configuring a Signing Certificate Fingerprint
Use the preceding signature file to generate a signing certificate fingerprint by referring to Huawei documentation, and configure the fingerprint in HUAWEI AppGallery Connect.
https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/appgallerykit-preparation#h2-1604304489444
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Packaging and Running the Demo
Step 1: Choose Android from the Platform area, and click Switch Platform.
Step 2: Click Build And Run and select the preceding signature file.
If this message is displayed, you can manually delete useProguard in the launcherTemplate.gradle file.
In this example, the following two lines are deleted.
Package and run the demo again.
Step 3: Check whether the packaged demo is normal.
Once you have packaged and run the demo, the following page is displayed.
Click Init. A message is displayed, indicating that the operation is successful.
Click Login and then login. The HUAWEI ID sign-in page is displayed, indicating that the demo is running successfully.
You can view the method of calling APIs for the demo in the following file in Unity, and call the corresponding APIs.
Note: If the sign-in page is not displayed, and the 6003 result code is returned, the signature fingerprint may be inconsistent. For details about how to fix this problem, check this post: What Can I Do When Result Code 6003 Is Returned?
Part1 of this thread: https://forum.xda-developers.com/t/...rovided-by-unity-part1.4212917/#post-84224243
Problem:
I was testing in-app purchases for my app but the payment page failed to launch. The log information is as follows.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
I checked the error code description in the official materials and found that it was because HUAWEI IAP wasn’t enabled. I checked the switch, and found that IAP has been enabled, but the problem persisted.
Analysis:
To resolve the problem, toggle on the IAP switch and configure IAP parameters, as shown in the following figures.
Document for enabling a service
2. If you used Android Studio to integrate the IAP SDK, download agconnect-services.json again by referring to the following figure and save the file to your app’s module directory of your project.
If you use Eclipse to integrate the SDK, check whether the appid and cpid parameters are correctly configured in the Manifest file.
Sample code:
XML:
<meta-data
android:name="com.huawei.hms.client.appid"
<!-- Replace xxx with the actual app ID, which can be obtained on the App information page. - ->
android:value="appid=xxx">
</meta-data>
<!-- Replace xxx with the actual payment ID, which can be obtained from the app's IAP information. -->
<meta-data
android:name="com.huawei.hms.client.cpid"
android:value="cpid=xxx">
</meta-data>
3. Once you have finished the preceding steps, if the problem still exists, wait for a while and try again, because there may be a one-hour delay due to cache issues.
ProblemI successfully integrated the HMS Core SDK (HMS 5.1.0.300 on Android Studio) during a test on Huawei mobile phones. However, when I loaded a game on a Xiaomi phone, it prompted me to update HMS Core, and when I tried to update it a parsing error occurred.
Analysis & SolutionWe contacted Huawei technical support in the game’s QQ group (if you have not joined the group, you can also submit a ticket to Huawei’s technical support team) and they advised us to:
Check whether HUAWEI AppGallery has been installed on the non-Huawei phone. If not, download and install HUAWEI AppGallery.
Check whether metadata has been configured. If the HMS Base SDK version is 5.0.4.300 or later, you need to configure the metadata shown in the following figure.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
The metadata has already been configured, meaning it is not the problem.
Finally, the technical support asked whether the provider section has been added to the manifest file.
If not, an error indicating package parsing failure will be reported when HMS Core (APK) is installed on some models.
Note: The value of applicationId must be the app’s ID.
After following these steps, the Xiaomi phone test works as expected.
These solutions will also work for other non-Huawei phones.