【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

相关推荐
HarmonyOS_SDK12 小时前
【FAQ】HarmonyOS SDK 闭源开放能力 —Push Kit
harmonyos
ChinaDragon15 小时前
HarmonyOS:ArkWeb在新窗口中打开页面
harmonyos
ChinaDragon17 小时前
HarmonyOS:通过组件导航设置标题栏动态显隐及隐藏类型
harmonyos
CHB1 天前
uni-app x 蒸汽模式 性能测试基准报告 Benchmark
uni-app·harmonyos
chenyingjian5 天前
鸿蒙|性能优化-概述与工具使用
harmonyos
二流小码农5 天前
鸿蒙开发:路由组件升级,支持页面一键创建
android·ios·harmonyos
TT_Close5 天前
【Flutter×鸿蒙】debug 包也要签名,这点和 Android 差远了
android·flutter·harmonyos
TT_Close5 天前
【Flutter×鸿蒙】FVM 不认鸿蒙 SDK?4步手动塞进去
flutter·swift·harmonyos
hqk6 天前
鸿蒙项目实战:手把手带你实现 WanAndroid 布局与交互
android·前端·harmonyos
TT_Close6 天前
【Flutter×鸿蒙】一个"插队"技巧,解决90%的 command not found
flutter·harmonyos