【HarmonyOS】鸿蒙获取appIdentifier,Identifier

【HarmonyOS】鸿蒙获取appIdentifier,Identifier

一、前言

三方后台需要填写的所谓appIdentifier,Identifier信息,其实对应鸿蒙应用的appID。

二、解决方案:

注意,模拟器获取data.signatureInfo.appIndentifer为空。需要使用真机。

dart 复制代码
  import { bundleManager} from '@kit.AbilityKit';


let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_SIGNATURE_INFO
try {
  bundleManager.getBundleInfoForSelf(bundleFlags).then((data) => {
  	// data.signatureInfo.appIndentifer
    hilog.info(0x0000, 'testTag', 'getBundleInfoForSelf successfully. Data: %{public}s', JSON.stringify(data));
  }).catch((err: BusinessError) => {
    hilog.error(0x0000, 'testTag', 'getBundleInfoForSelf failed. Cause: %{public}s', err.message);
  });
} catch (err) {
  let message = (err as BusinessError).message;
  hilog.error(0x0000, 'testTag', 'getBundleInfoForSelf failed: %{public}s', message);
}

或者登陆使用华为开发者账号登录 AppGallery Connect

相关推荐
2601_9495936520 小时前
高级进阶React Native 鸿蒙跨平台开发:LinearGradient 背景渐变与主题切换
react native·react.js·harmonyos
深海呐20 小时前
鸿蒙基本UI控件(List相关-含Grid)
harmonyos·harmonyos ui·harmonyos list·harmonyos grid·鸿蒙列表view·art列表ui控件·art网格ui控件
小雨青年20 小时前
鸿蒙 HarmonyOS 6 | AI Kit 集成 Core Speech Kit 语音服务
人工智能·华为·harmonyos
一起养小猫21 小时前
Flutter for OpenHarmony 实战 表单处理与验证完整指南
android·开发语言·前端·javascript·flutter·harmonyos
摘星编程1 天前
React Native鸿蒙版:自定义useMask输入掩码
react native·react.js·harmonyos
mocoding1 天前
使用Flutter设置UI三方库card_settings_ui重构鸿蒙版天气预报我的页面
flutter·ui·harmonyos
摘星编程1 天前
OpenHarmony + RN:自定义useValidator表单验证
react native·react.js·harmonyos
摘星编程1 天前
OpenHarmony环境下React Native:自定义useFieldArray字段数组
react native·react.js·harmonyos
2601_949593651 天前
基础入门 React Native 鸿蒙跨平台开发:FlatList 性能优化
react native·性能优化·harmonyos
熊猫钓鱼>_>1 天前
【开源鸿蒙跨平台开发先锋训练营】Day 15: 赋予应用生命力——React Native原生动效体系构建
react native·华为·开源·harmonyos·arkts·鸿蒙