鸿蒙开发(NEXT/API 12)【硬件(取消注册智慧出行连接状态的监听)】车载系统

取消注册智慧出行连接状态的监听。

接口说明

接口名 描述
off (type: 'smartMobilityStatus', smartMobilityTypes: SmartMobilityType\[\], callback?: Callback): void 取消注册智慧出行连接状态的监听。

开发步骤**

  1. 导入Car Kit模块。

    复制代码
    import { smartMobilityCommon } from '@kit.CarKit';
  2. 获取SmartMobilityStatusAwareness实例。

    复制代码
    let awareness: smartMobilityCommon.SmartMobilityAwareness = smartMobilityCommon.getSmartMobilityAwareness();
  3. 取消注册智慧出行连接状态的监听。

    // 业务类型
    let types: smartMobilityCommon.SmartMobilityType[] = [smartMobilityCommon.SmartMobilityType.CAR_HOP];
    // 出行连接状态回调函数
    const callBack = (info: smartMobilityCommon.SmartMobilityInfo) => {
    hilog.info(0x0000, 'Received smart mobility info: ', JSON.stringify(info));
    };
    // 解注册智慧出行连接状态的监听 示例1
    // awareness.off('smartMobilityStatus', types);
    // 解注册智慧出行连接状态的监听 示例2
    awareness.off('smartMobilityStatus', types, callBack);

相关推荐
鸿蒙开发2 小时前
共享 Schema 与 SchemaFactory
前端·后端·harmonyos
二流小码农4 小时前
HarmonyOS开发助手,0代码让元服务从开发到上架
android·ios·harmonyos
产品人卫朋5 小时前
MTL如何把市场机会转化为有效销售线索?
人工智能·华为·产品经理·ipd流程·流程架构·mtl流程
贾伟康6 小时前
【共创稿事节】第一张服务卡片:2×2 今日菜谱的克制设计
microsoft·harmonyos·arkts·鸿蒙
2501_944525766 小时前
开源鸿蒙平台 KMP_CMP 三方库「Atrium」适配全流程
microsoft·开源·harmonyos
less_121386 小时前
鸿蒙 WPS Open SDK 二开复盘:从注册、打开到回传的完整能力链
服务器·sdk·harmonyos·wps·鸿蒙开发
2601_949575867 小时前
开源鸿蒙平台 CMP 三方库「voyager」适配全流程
华为·开源·harmonyos
2601_949575868 小时前
开源鸿蒙平台 CMP 三方库「compose-multiplatform-2048」适配全流程
华为·开源·harmonyos
网络豆11 小时前
开源鸿蒙平台 CMP 三方库「kmp-compose-tab-container」适配全流程
华为·开源·harmonyos
2601_9495758611 小时前
开源鸿蒙平台 KMP_CMP 三方库「PreCompose」适配全流程
华为·开源·harmonyos