【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

相关推荐
bestadc1 小时前
鸿蒙 ArkTS 常用的数组和字符串 操作方法
harmonyos
国服第二切图仔5 小时前
鸿蒙Next API17新特性学习之如何使用新增鼠标轴事件
harmonyos·鸿蒙系统
lqj_本人5 小时前
鸿蒙OS&UniApp实现个性化的搜索框与搜索历史记录#三方框架 #Uniapp
华为·uni-app·harmonyos
SuperHeroWu78 小时前
【HarmonyOS 5】鸿蒙mPaaS详解
华为·harmonyos·鸿蒙·mpaas·alipay
Bruce_Liuxiaowei9 小时前
HarmonyOS NEXT~React Native在鸿蒙系统(HarmonyOS)上的适配现状与技术展望
react native·华为·harmonyos
国服第二切图仔14 小时前
鸿蒙Next API17学习新特性之组件可见区域变化事件新增支持设置事件的回调参数,限制它的执行间隔
harmonyos·鸿蒙系统
学无止境--有分享有梦想15 小时前
HarmonyOS概述
harmonyos·鸿蒙
卓应19 小时前
2025年5月华为H12-821新增题库带解析
网络·华为·智能路由器
_waylau19 小时前
华为2024年报:鸿蒙生态正在取得历史性突破
华为·开源·harmonyos
Huang兄21 小时前
#跟着若城学鸿蒙# 鸿蒙-卡证识别
harmonyos