Your app can initiate multi-network concurrency for network acceleration based on the service needs and relevant suggestions provided by the device, and promptly release it when the use is complete. Wi-Fi–cellular and primary–secondary SIM combinations are supported for concurrency. Connection paths cannot be freely combined. All combinations are determined by the device.
Primary–secondary SIM concurrency requires that Smart Data Switch be enabled and depends on the frequencies of the networks the two SIM cards reside on. If concurrency conditions are not met (for example, when both SIM cards are from the same carrier), multi-network concurrency initiation will fail.
Due to hardware restrictions, some devices do not support multi-network concurrency in dual-SIM scenarios. You can check the returned error code for details.
If the current transmission protocol does not support a specific network to be added for multi-network concurrency, that network cannot be used. For example, if HTTP supports only the default network, but does not support the added network, multi-network concurrency is not available.
To initiate multi-network concurrency, ensure that the network acceleration switch is enabled under Settings > Mobile network > Network acceleration on the device. If you cannot find this switch on a device, the device/ROM does not support multi-network concurrency.
For details about the APIs, please refer to API Reference.
| API | Description |
|---|---|
| requestMultiPath(callback: Callback<MultiPathRequestResult>): void | Initiates a multi-network concurrency request. |
| releaseMultiPath(): void | Releases multi-network concurrency. |
Import the Network Boost Kit module.
import { netHandover } from '@kit.NetworkBoostKit';
import { BusinessError } from '@kit.BasicServicesKit'; Initiate a multi-network concurrency request and listen for multi-network concurrency status changes.
try {
netHandover.requestMultiPath((data: netHandover.MultiPathRequestResult) => {
console.info(` requestMultiPath result:` + JSON.stringify(data));
});
} catch (err) {
console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message);
} Call the releaseMultiPath API to release multi-network concurrency after your app process ends.
try {
netHandover.releaseMultiPath();
} catch (err) {
console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message);
}