【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

相关推荐
IT从业者张某某6 小时前
【鸿蒙PC命令行适配】GitUI 移植的工程实践:双 Git 引擎(libgit2/gitoxide)的鸿蒙适配之路
git·华为·harmonyos
lqj_本人6 小时前
WinPcap 鸿蒙 PC 适配全记录:从 NPF 原始抓包到 VPN_TUN 与 libpcap 双通路
qt·华为·harmonyos
●VON7 小时前
Flutter 鸿蒙插件适配实战:用 device_screen_brightness 2.0.0 控制并监听屏幕亮度
flutter·华为·harmonyos
ChinaDragon7 小时前
HarmonyOS:应用横竖屏切换
harmonyos
颜颜yan_7 小时前
ESP-IDF 鸿蒙 PC 适配全记录:打通 Python、构建工具链与 ESP32-P4 固件生成
python·华为·harmonyos
梦想不只是梦与想10 小时前
鸿蒙 邀请测试:AppGallery邀请测试流程
harmonyos·appgallery 邀请测试·邀请测试
贾伟康13 小时前
【口算王|02】HarmonyOS ArkTS 答题提交实战:防止重复提交并推进下一题
harmonyos·arkts·状态管理·arkui·幂等设计
承渊政道15 小时前
Python IDLE鸿蒙PC适配全记录:从Tkinter桌面程序到ArkUI原生开发闭环
开发语言·python·harmonyos·鸿蒙系统·桌面程序
万物智能信息科技15 小时前
电容触摸 FT5406,另一颗芯片、同一条总线—【万物智能之开源鸿蒙OpenHarmony系统实战开发系列教程】
人工智能·华为·开源·harmonyos·鸿蒙
ChinaDragonDreamer15 小时前
HarmonyOS:应用程序包管理模块(获取当前应用信息)
harmonyos·鸿蒙