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

相关推荐
呆萌很4 小时前
HCIP-HarmonyOS Application Developer 习题(四)
华为·harmonyos
Android技术栈6 小时前
鸿蒙开发(NEXT/API 12)【状态查询与订阅】手机侧应用开发
华为·系统架构·harmonyos·鸿蒙·鸿蒙系统·openharmony
Android技术栈8 小时前
鸿蒙开发(NEXT/API 12)【硬件(传感器开发)】传感器服务
华为·硬件架构·harmonyos·鸿蒙·鸿蒙系统·openharmony·传感器
OH五星上将9 小时前
【移植】一种快速移植OpenHarmony Linux内核的方法
linux·运维·驱动开发·嵌入式硬件·harmonyos·openharmony·鸿蒙内核
深海的鲸同学 luvi9 小时前
HarmonyOS/OpenHarmony 如何将rawfile中文件复制到沙箱中
华为·harmonyos·文件操作·解压·h5离线加载·拷贝
helloxmg9 小时前
鸿蒙harmonyos next flutter通信之EventChannel获取ohos系统时间
flutter·华为·harmonyos
90后的晨仔10 小时前
UIAbility、ExtensionAbility、HAP、AbilityStage在运行期和编译器的关系
harmonyos
90后的晨仔10 小时前
UIAbility相关的基础知识概念介绍
harmonyos
weixin_4307509312 小时前
防火墙的区域划分+来自公网、内网的ip欺骗攻击+防御
运维·网络·网络协议·tcp/ip·华为·安全威胁分析