目录

Setting the Service Scenario (C/C++)

Starting from version 6.0.2(22), this kit supports setting the service scenario.

Use Case

This section describes how to set the service scenario for your app before requesting multi-network concurrency, so the device can manage multi-network concurrency and perform service duration analysis accordingly.

API Description

For details about the APIs, please refer to API Reference.

API Description
int32_t HMS_NetworkBoost_SetSceneDesc(NetworkBoost_SceneDesc sceneDesc) Sets the service scenario.

Development Procedure

  1. Import the Network Boost Kit module.

    #include "NetworkBoostKit/network_boost.h"
    #include <cstdio>
  2. Add the following library to the CMakeLists.txt file. For details, please refer to Preparations for C API Development.

    libnetwork_boost.so
  3. Call the SetSceneDesc() API.

    int32_t SetSceneDesc()
    {
        NetworkBoost_SceneDesc sceneDesc;
        sceneDesc.duration = 0;
        sceneDesc.startTime = 0;
        sceneDesc.scene = NB_SERVICE_LOGIN;
        sceneDesc.sceneEvent = SCENE_EVENT_ENTER;
        int32_t ret = HMS_NetworkBoost_SetSceneDesc(sceneDesc);
        if (ret == 0) {
            printf("Service scenario set successfully: duration=%ld, startTime=%ld, scene=%d, sceneEvent=%d\n",
                sceneDesc.duration, sceneDesc.startTime, sceneDesc.scene, sceneDesc.sceneEvent);
        } else {
            printf("Failed to set the service scenario. Error code: %d\n", ret);
        }
        return ret;
    }