Result Code 6004 Reported When an HMS Core SDK API Is Called
After my game integrated the HMS Core SDK, players could not sign in to my game. When the getCurrentPlayer API was called, result code 6004 was returned. I searched the keyword hmssdk in log information and found the following error information:
Line 291: I/HMSSDK_HmsClient: receive msg status_code:0, error_code6004, api_name:game.getCurrentPlayer
According to the result code description, this result code indicates that permission is not granted from HUAWEI Developers.
Since the result code indicates that the required permission has not been granted, I checked the API enabling status by referring to Enabling Services.
It was found that all involved services had been enabled. That means I had required permissions. It was really confusing. So i contacted Huawei technical support. They offered me this solution:
- If the required API is not enabled, enable it. Then wait for about 15 minutes, clear the HMS Core (APK) cache on the test phone, and check whether sign-in can be successful.
- If the API has been enabled, the possible cause is that an exception occurs when the API is enabled, which rarely happens. As a result, Huawei server does not receive the synchronized API enabling request. In this case, you can manually disable the API and then enable it again to trigger message synchronization. Similarity, clear the HMS Core (APK) cache, wait for 15 minutes, and perform the test again.
To clear the HMS Core (APK) cache, go to Settings > Apps > Apps > HMS Core on your test device, and clear the cache.
I tried the latter solution, and my game can be signed in properly again.