鸿蒙开发(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);

相关推荐
博客-小覃20 小时前
Zabbix之华为交换机的日志记录信息操作详细教程
服务器·网络·华为·zabbix
不羁的木木1 天前
Form Kit(卡片开发服务)学习笔记01-核心概念与架构设计
笔记·学习·harmonyos
不羁的木木1 天前
ArkWeb实战学习笔记01-核心概念与架构设计
笔记·学习·harmonyos
Goway_Hui1 天前
【鸿蒙原生应用开发--ArkUI--010】Recipe-app 菜谱应用开发教程
华为·harmonyos
●VON1 天前
鸿蒙 BodyAR 实战:基于人体骨骼追踪的体感运动计数器开发全解
华为·ar·harmonyos·鸿蒙·新特性
Davina_yu1 天前
页面路由导航:Router与Navigation组件的跳转传参(7)
harmonyos·鸿蒙·鸿蒙系统
Ww.xh1 天前
鸿蒙WebView IPC防伪造请求方案
华为·harmonyos
大雷神1 天前
第25篇|Surface 预览控制:ArkUI 页面如何接住相机画面
harmonyos
大雷神1 天前
第24篇|相机权限和设备枚举:先判断能力再打开预览
harmonyos
川石课堂软件测试1 天前
使用mock进行接口测试教程
数据库·python·功能测试·测试工具·华为·单元测试·appium