Why Doesn’t My Game’s Trial Play Function Take Effect? - Huawei Developers

Symptom​I have integrated the trial play function provided by the HMS Core Game Service SDK 5.0.1.302 into my game and completed the following as instructed by the official documentation:
Applying to enable the forcible identity verification function.
Adding code snippet for implementing trial play to my game code.
However, when my game was launched and the identity verification pop-up was displayed, the trial play option was not available, which means that the function did not take effect.
Analysis​It was the first time I integrated the HMS Core SDK, so I contacted Huawei technical support. I was informed of some of the prerequisites for enabling the trial play function:
1. The integrated Game Service SDK version must be 5.0.1 or later.
2. The forcible identity verification has been enabled.
3. Code relating to the trial play function has been added.
4. The default authorization parameter of the game must be DEFAULT_AUTH_REQUEST_PARAM_GAME.
We have met the first three, but not the last one.
{
"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"
}
Solution​Finally, I modified my code by referring to the documentation, and it worked! Hope this post can offer you some help!

Am not sure but check the code for suttle errors

Tennaric said:
Am not sure but check the code for suttle errors
Click to expand...
Click to collapse
this is just a sample code. you can refer to this site to confirm the correct usage. you can even download the sample code in github.

Related

A Case Study of Resolving 403 Error During PMS API Call

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

Resolving HTTP 502 Error During Leaderboard API Calls

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

Resolving HTTP 502 Error During Leaderboard API Calls

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

How Can I Use the HUAWEI Game Service Demo Provided by Unity? - Part2

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

What Can I Do If a Parsing Error Occurs When I Update HMS Core (APK) on Non-Huawei Phones

Problem​I 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 & Solution​We 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.

Categories

Resources