A standalone game is a game in which data is stored locally and no server connection is required.
After integrating the basic game service, a standalone game allows users to quickly sign in with a HUAWEI ID. The basic game service also provides HUAWEI ID identity verification and anti-addiction for minors for standalone games.
To release a game on AppGallery, you need to create a game app in AppGallery Connect. For details, please refer to Creating a HarmonyOS App. Relevant parameters need to be set as follows:
App type: Select HarmonyOS app.
Level-1 app category: Select Game
It is recommended that the name of the game package for official release not contain words such as test and dev.
According to the Notice on Carrying Out the Interface Integration Work for the Online Game Anti-Addiction Identity Verification System issued by the National Press and Publication Administration, all game publishing and operating enterprises were required to complete interconnection with the online game anti-addiction identity verification system before June 1, 2021, and obtain the bizID (game filing identification code). After that, you need to configure the game's bizID in AppGallery Connect so that Huawei can automatically connect the game to the National Press and Publication Administration's identity verification system and enable mandatory identity verification for the game. No additional development is required from developers.
The signing information, including the digital certificate and profile, can ensure the integrity of your game.
Debugging phase: Sign your app manually, request a debug certificate, and request a debug profile.
Release phase: Sign your app manually, request a release certificate, and request a release profile.
AppGallery Connect automatically generates a public key for the certificate and calculates the SHA-256 fingerprint. You need to obtain and configure the SHA-256 fingerprint in AppGallery Connect. Each game can add a maximum of four signing certificate fingerprints. For details, please refer to Configuring a Public Key Fingerprint.
Add the fingerprint of the debug certificate in the debugging phase, and add the fingerprint of the release certificate in the release phase.
Sign in to AppGallery Connect, choose Development and services, select your project and game, and obtain the app ID and client ID under App information.

In the module.json5 file of the entry module in the project, add metadata, configure client_id and app_id in metadata, and add requestPermissions to configure the network permission. The sample code is as follows:
"module": {
"name": "entry",
"type": "xxx",
"description": "xxxx",
"mainElement": "xxxx",
"deviceTypes": [],
"pages": "xxxx",
"abilities": [],
"metadata": [ // Configure the following information:
{
"name": "client_id",
"value": "xxxxxx" // Set it to the client ID obtained in the preceding step.
},
{
"name": "app_id",
"value": "xxxxxx" // Set it to the app ID obtained in the preceding step.
}
],
"requestPermissions": [ // Configure the network permission.
{
"name": "ohos.permission.INTERNET"
}
]
} To implement game asset sharing between HarmonyOS 5.0 or later and HarmonyOS 4 or earlier, you need to configure the app ID mapping before releasing your game.
When configuring the mapping, ensure that the player ID type (playerId/openId) of the game on HarmonyOS 4 or earlier is correct to ensure the accuracy of data inheritance.
If the app ID mapping is missing or incorrectly configured, account assets may fail to be shared.
Sign in to AppGallery Connect, choose Development and services, select your project and game, choose Build > Game Service from the navigation pane on the left, and click New Configuration.

In the Adding configuration information dialog box, set the parameters and click Next step.
Ensure that the mapping between the game (in HAP format) and the game (in APK format) is correctly configured. If you select a game of an incorrect type, a dialog box will be displayed, prompting you to select the correct game.

| Item | Description |
|---|---|
| HarmonyOS 5.0 and above game | Select the game (in HAP format) to be released. |
| HarmonyOS 4 and below game | Select the corresponding game (in APK format) that has been released or is to be released. |
In the displayed dialog box, set the parameters and click Next step.

(Optional) Enter the callback address of your server and click OK to submit the app ID mapping for approval.

Any exceptions (for example, the release status does not meet the requirements) will be indicated in red text in the dialog box shown below. You are advised to click Cancel and reconfigure the app ID mapping. If you ignore the exceptions and click OK to continue submitting, your app ID mapping configuration may be rejected.

After you submit your request, it will take 1–3 working days for Huawei staff to complete the review.
If you want to reconfigure the app ID mapping after it has taken effect, submit a deletion request for the mapping first.

The review result of the app ID mapping configuration or deletion request will be sent to you through the interaction center or email.


The player launches the game.
The game calls the init API to initialize Game Service Kit. After the initialization, the Statement About HUAWEI Game Services and Privacy is displayed. Once the player accepts the terms, the process continues.
The game calls the unionLogin API with the showLoginDialog parameter set to false and the thirdAccountInfos parameter set to an empty array.
The game displays a welcome banner at the top of the screen. Game Service Kit returns the information to the game, including accountName (hw_account for HUAWEI ID sign-in), accountIdentifier (hw_account for HUAWEI ID sign-in), and gamePlayerId.
Call the verifyLocalPlayer API to perform compliance verification on the HUAWEI ID signed in on the user's device. After the verification is successful, the player enters the game.
For details about the APIs, please refer to API Reference.
| API | Description |
|---|---|
| init(context: common.UIAbilityContext, callback: AsyncCallback<void>): void | Initializes Game Service Kit when the game is launched. This API must be called before other APIs are called. This API uses an asynchronous callback to return the result. |
| unionLogin(context: common.UIAbilityContext, loginParam: UnionLoginParam): Promise<UnionLoginResult> | Signs in to the game. This API uses a promise to return the result. |
| verifyLocalPlayer(context: common.UIAbilityContext, thirdUserInfo: ThirdUserInfo): Promise<void> | Verifies compliance, including the identity verification status and anti-addiction information of the HUAWEI ID signed in on the current device. This API uses a promise to return the result. |
Import the Game Service Kit module and related common modules.
import { gamePlayer } from '@kit.GameServiceKit';
import { common } from '@kit.AbilityKit';
import { hilog } from '@kit.PerformanceAnalysisKit';
import { BusinessError } from '@kit.BasicServicesKit';
import { window } from '@kit.ArkUI'; Call the init API to initialize Game Service Kit.
The class calling this API must extend UIAbility, and the context must be obtained only after the page has successfully loaded in the onWindowStageCreate lifecycle method.
Your game can call other APIs only after successfully calling the init API. Otherwise, your game release request will be rejected.
onWindowStageCreate(windowStage: window.WindowStage) {
windowStage.loadContent('pages/index', (err, data) => {
try {
gamePlayer.init(this.context, ()=>{
hilog.info(0x0000, 'testTag', `Succeeded in initializing.`);
});
} catch (error) {
let err = error as BusinessError;
hilog.error(0x0000, 'testTag', `Failed to init. Code: ${err.code}, message: ${err.message}`);
}
});
} After the initialization, the Statement About HUAWEI Game Services and Privacy is displayed. Once the user accepts the terms, the process continues.

If the current HUAWEI ID has already agreed to the Statement About HUAWEI Game Services and Privacy, games that use this HUAWEI ID for sign-in will no longer display this pop-up.
Call the unionLogin API to sign in to the game.
let context = this.getUIContext()?.getHostContext() as common.UIAbilityContext;
let request: gamePlayer.UnionLoginParam = {
showLoginDialog: false, // Indicates whether to display the multi-provider sign-in panel. The value true indicates that the panel is forcibly displayed. The value false indicates that the sign-in method selected by the player last time is preferentially used and the multi-provider sign-in panel is not forcibly displayed. If the player is signing in for the first time or has reinstalled the game, the sign-in panel will be displayed.
thirdAccountInfos: [] // For standalone games, pass an empty array.
};
try {
gamePlayer.unionLogin(context, request).then((result: gamePlayer.UnionLoginResult) => {
hilog.info(0x0000, 'testTag', `Succeeded in logging in: ${result?.accountName}`);
}).catch((error: BusinessError) => {
hilog.error(0x0000, 'testTag', `Failed to login. Code: ${error.code}, message: ${error.message}`);
});
} catch (error) {
let err = error as BusinessError;
hilog.error(0x0000, 'testTag', `Failed to login. Code: ${err.code}, message: ${err.message}`);
} After the player completes the sign-in process, a welcome banner is displayed on the top of the game, and information such as accountName (hw_account for HUAWEI ID sign-in) and gamePlayerId is returned to the game.

Call the verifyLocalPlayer API to verify the identity verification status and minor anti-addiction information of the HUAWEI ID signed in on the current device. After successful verification, the player enters the game.
let context = this.getUIContext()?.getHostContext() as common.UIAbilityContext;
let request: gamePlayer.ThirdUserInfo = {
thirdOpenId: '' // Leave this parameter empty for standalone games.
};
try {
gamePlayer.verifyLocalPlayer(context, request).then(() => {
hilog.info(0x0000, 'testTag', `Succeeded in verifying.`);
}).catch((error: BusinessError) => {
hilog.error(0x0000, 'testTag', `Failed to verify. Code: ${error.code}, message: ${error.message}`);
});
} catch (error) {
let err = error as BusinessError;
hilog.error(0x0000, 'testTag', `Failed to verify. Code: ${err.code}, message: ${err.message}`);
} For HUAWEI IDs, the basic game service provides identity verification and anti-addiction for minors, and IAP Kit provides payment compliance control (for example, payment limits for minors).
| Compliance Verification | Item | National Policy | Solution |
|---|---|---|---|
| HUAWEI ID identity verification | Check whether the HUAWEI ID signed in on the device has completed identity verification. | In accordance with relevant laws and regulations, all online game players must register and sign in with valid and authentic identity information. | When a player signs in with a HUAWEI ID that has not completed identity verification, the basic game service will display a pop-up prompting them to complete the process. If the player cancels identity verification, error code 1002000004 will be returned. |
| Anti-addiction for minors | Check whether a HUAWEI ID that has completed identity verification and is identified as belonging to a minor signs in to the game within the permitted time period. | In accordance with the latest regulations of the National Press and Publication Administration, all online game enterprises can provide minors with only 1 hour of online game services from 20:00 to 21:00 on Fridays, Saturdays, Sundays, and statutory holidays. No online game services can be provided to minors in any form in other time periods. | - If a HUAWEI ID that has completed identity verification and is identified as belonging to a minor signs in during the permitted time period, the basic game service displays a pop-up at 21:00, informing the player that their game time has ended. The player will then be forcibly signed out, and error code 1002000006 will be returned. - If a HUAWEI ID that has completed identity verification and is identified as belonging to a minor signs in beyond the permitted time period, the basic game service displays a pop-up, informing the player that they are not allowed to play. The player will then be forcibly signed out, and error code 1002000006 will be returned. |
| Payment limits for minors | Check whether a HUAWEI ID that has completed identity verification and is identified as belonging to a minor is subject to payment limits. | In accordance with the latest regulations of the National Press and Publication Administration, online game companies are prohibited from offering paid game services to users under the age of 8. For paid game services provided by the same online game company: users aged 8–15 are limited to a top-up amount of CNY50 per transaction and CNY200 per month in total; users aged 16–17 are limited to a top-up amount of CNY100 per transaction and CNY400 per month in total. | If a HUAWEI ID that has completed identity verification and is identified as belonging to a minor exceeds the in-game payment limit, IAP Kit will display a pop-up, indicating that the spending restriction has been exceeded. When a user uses Huawei in-app purchases, Huawei will automatically enforce payment limit controls according to the requirements of the National Press and Publication Administration. No action is required from you in this case. |