当前位置: 首页 > news >正文

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

http://www.mrgr.cn/news/36993.html

相关文章:

  • 【Java】字符串处理 —— String、StringBuffer 与 StringBuilder
  • 找到你的工具!5款免费可视化报表工具对比分析
  • 什么是 Servlet? 它的主要用途是什么?
  • 行情叠加量化,占据市场先机!
  • WAF,全称Web Application Firewall,好用WAF推荐
  • UGUI动态元素大小的滑动无限列表
  • 哈希表(一)
  • 【Python语言初识(五)】
  • 828华为云征文|使用Flexus X实例安装宝塔面板教学
  • (二)Optional
  • 数据结构编程实践20讲(Python版)—02链表
  • Shell脚本基础——实训项目任务
  • 超详细的 pytest教程 之前后置方法和 fixture 机制
  • 【C++】入门基础知识-1
  • 如何从huggingface下载
  • 循环神经网络笔记
  • linux常用命令(cheng)
  • C++学习笔记(45)
  • C++(string字符串、函数)
  • 【Linux】Linux工具——CMake入门