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

相关推荐
大雷神25 分钟前
HarmonyOS智慧农业管理应用开发教程--高高种地--第12篇:成本核算系统
harmonyos
BlackWolfSky1 小时前
鸿蒙中级课程笔记2—状态管理V2—@Computed装饰器:计算属性
笔记·华为·harmonyos
王然-HUDDM2 小时前
技术领跑:HUDDM-7D系统L4级功能安全预研验证
人工智能·嵌入式硬件·安全·车载系统·汽车
BlackWolfSky3 小时前
鸿蒙中级课程笔记2—状态管理V2—@Local
笔记·华为·harmonyos
时光慢煮3 小时前
Flutter × OpenHarmony 跨端开发实战:动态显示菜单详解
flutter·华为·开源·openharmony
Easonmax4 小时前
零基础入门 React Native 鸿蒙跨平台开发:3——固定表头表格实现
react native·react.js·harmonyos
不爱吃糖的程序媛5 小时前
【仓颉开发实战】基于 OpenHarmony 实现拨打电话功能
harmonyos
时光慢煮5 小时前
Flutter × OpenHarmony:构建高效文章列表界面实践
flutter·华为·开源·openharmony
大雷神5 小时前
HarmonyOS智慧农业管理应用开发教程--高高种地--第13篇:销售管理与助手
harmonyos
Easonmax5 小时前
零基础入门 React Native 鸿蒙跨平台开发:9——表格数据动态加载与分页
react native·react.js·harmonyos