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.
For details about the APIs, please refer to API Reference.
| API | Description |
|---|---|
| setSceneDesc(sceneDesc : SceneDesc): void | Sets the service scenario. |
Import the Network Boost Kit module.
import { netBoost } from '@kit.NetworkBoostKit';
import { BusinessError } from '@kit.BasicServicesKit'; 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);
}