目录

Setting the Service Scenario

Use Case

You can 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
setSceneDesc(sceneDesc : SceneDesc): void Sets the service scenario.

Development Procedure

  1. Import the Network Boost Kit module.

    import { netBoost } from '@kit.NetworkBoostKit';
    import { BusinessError } from '@kit.BasicServicesKit';
  2. Set the service scenario.

    try {
      let sceneDesc : netBoost.SceneDesc = {
        // scene: 'realtimeVoice' indicates the real-time voice service scenario, which can be configured based on service requirements. sceneEvent: SCENE_EVENT_ENTER indicates the event of entering a scenario.
        scene : 'realtimeVoice',
        sceneEvent : netBoost.SceneEvent.SCENE_EVENT_ENTER
      }
      netBoost.setSceneDesc(sceneDesc);
    } catch (err) {
      console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message);
    }