A user launches the game by tapping the app icon. At that moment, the app background initializes HMS SDK.

A user launches the game by tapping the game app icon on a mobile device.
The game app executes its startup program and loads the required resources. The startup program is created by the developer.
In the startup program, the game app calls JosApps.getJosAppsClient method to obtain the JosAppsClient instance.
HMS SDK returns the current JosAppsClient instance of the game app.
The app calls the JosAppsClient.init method to initialize the game.
After successful startup, the game app displays the home page and checks for updates. For details about the app upgrade process, see Updating the game.
The functions involved in this scenario must be implemented upon app startup, rather than during user operations such as sign-in and payment. If this requirement is not followed, the app will be rejected during review.
The key steps for launching the game are as follows:
1. Add the following code to the onCreate method of the Application to register the callback listening function of the activity.
- public class MyApplication extends Application{
- @Override
- public void onCreate(){
- super.onCreate();
- HuaweiMobileServicesUtil.setApplication(this);
- }
- }
2. Call JosApps.getJosAppsClient to initialize the JosAppsClient object and JosAppsClient.init to initialize the game.
- private void init() {
- JosAppsClient appsClient = JosApps.getJosAppsClient(this, null);
- appsClient.init();
- Log.i(TAG, "init success");
- }
No result will display after init is called, and no action is required from your app.