HarmonyOS getDefaultCellularDataSlotIdSync接口在平板上无法使用?

import data from '@ohos.telephony.data';

let slotId: number = data.getDefaultCellularDataSlotIdSync();

设置deviceType包括tablet时,就会有如下编译告警:

The default system capabilities of devices default,tablet do not include system capability of 'getDefaultCellularDataSlotIdSync'. Configure the capabilities in syscap.json. It may cause your application crush in some devices. Attention: Such illegal interface call will lead to compilation error in the future version!
阅读 469
1 个回答

平板可能不支持SIM卡,因此tablet.json中不默认配置这个权限,编译告警是为了提示开发者要关注运行时校验,开发者可使用canIUse隔离。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进