• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# FAQs About Application Packages
2<!--Kit: Ability Kit-->
3<!--Subsystem: BundleManager-->
4<!--Owner: @wanghang904-->
5<!--Designer: @hanfeng6-->
6<!--Tester: @kongjing2-->
7<!--Adviser: @Brilliantry_Rui-->
8
9## How do i obtain the fingerprint in the signature information?
10
11* Call an API.
12
13You can call [bundleManager.getBundleInfoForSelf](../reference/apis-ability-kit/js-apis-bundleManager.md#bundlemanagergetbundleinfoforself) to obtain the bundle information, which contains the signature information, and signature information in turn contains fingerprint information.
14
15```ts
16import { bundleManager } from '@kit.AbilityKit';
17import { BusinessError } from '@kit.BasicServicesKit';
18import { hilog } from '@kit.PerformanceAnalysisKit';
19
20let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_SIGNATURE_INFO;
21try {
22  bundleManager.getBundleInfoForSelf(bundleFlags).then((bundleInfo:bundleManager.BundleInfo) => {
23    console.info('testTag', 'getBundleInfoForSelf successfully. fingerprint: %{public}s', bundleInfo.signatureInfo.fingerprint);
24  }).catch((err: BusinessError) => {
25    console.error('testTag', 'getBundleInfoForSelf failed. Cause: %{public}s', err.message);
26  });
27} catch (err) {
28  let message = (err as BusinessError).message;
29  console.error('testTag', 'getBundleInfoForSelf failed: %{public}s', message);
30}
31```
32
33* Use [Bundle Manager](../tools/bm-tool.md) (bm).
34
35```shell
36hdc shell
37# Replace **com.example.myapplication** with the actual bundle name.
38bm dump -n com.example.myapplication | grep fingerprint
39```
40
41![alt text](figures/get_fingerprint.png)
42
43* Use the **keytool**. For details, see [Generating a Signing Certificate Fingerprint](https://developer.huawei.com/consumer/en/doc/AppGallery-connect-Guides/appgallerykit-preparation-game-0000001055356911#section147011294331).
44
45## What is appIdentifier?
46
47**appIdentifier**, generated during application signing, is a field in the [profile](https://developer.huawei.com/consumer/en/doc/app/agc-help-add-releaseprofile-0000001914714796) and is the unique identifier of an application. There are two ways to generate an application identifier:
481. The **appIdentifier** field is randomly generated through [automatic signing](https://developer.huawei.com/consumer/en/doc/harmonyos-guides/ide-signing#section18815157237) on DevEco Studio. Signing on different devices or re-signing will result in different values of **appIdentifier**.
492. The **appIdentifier** field in the [debug profile](https://developer.huawei.com/consumer/en/doc/app/agc-help-debug-profile-0000002248181278) or [release profile](https://developer.huawei.com/consumer/en/doc/app/agc-help-release-profile-0000002248341090) is fixed if you manually sign and request a profile in AppGallery Connect. This field comes from the [App ID](https://developer.huawei.com/consumer/en/doc/app/agc-help-createharmonyapp-0000001945392297) generated when the application is created in AppGallery Connect and is distributed by the cloud. In this case, the **appIdentifier** field does not change along the application lifecycle, including version updates, certificate changes, public and private key changes, and application transfers.
50
51Therefore, manual signing is recommended in scenarios where **appIdentifier** must remain unchanged, such as cross-device debugging, cross-application interaction debugging, or multi-user development with a shared key. For details, see [Use Cases for Automatic and Manual Signing](https://developer.huawei.com/consumer/en/doc/harmonyos-guides/ide-signing#section54361623194519).
52
53## How do I obtain appidentifier from application information?
54
55* You can call [bundleManager.getBundleInfoForSelf](../reference/apis-ability-kit/js-apis-bundleManager.md#bundlemanagergetbundleinfoforself) to obtain the bundle information, which contains the signature information, and signature information in turn contains the **appIdentifier**.
56
57```ts
58import { bundleManager } from '@kit.AbilityKit';
59import { BusinessError } from '@kit.BasicServicesKit';
60import { hilog } from '@kit.PerformanceAnalysisKit';
61
62let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_SIGNATURE_INFO;
63try {
64  bundleManager.getBundleInfoForSelf(bundleFlags).then((bundleInfo:bundleManager.BundleInfo) => {
65    console.info('testTag', 'getBundleInfoForSelf successfully. appIdentifier: %{public}s', bundleInfo.signatureInfo.appIdentifier);
66  }).catch((err: BusinessError) => {
67    console.error('testTag', 'getBundleInfoForSelf failed. Cause: %{public}s', err.message);
68  });
69} catch (err) {
70  let message = (err as BusinessError).message;
71  console.error('testTag', 'getBundleInfoForSelf failed: %{public}s', message);
72}
73```
74
75* Use the [bm](../tools/bm-tool.md) tool.
76
77```shell
78hdc shell
79# Replace **com.example.myapplication** with the actual bundle name.
80bm dump -n com.example.myapplication | grep appIdentifier
81```
82
83![alt text](figures/get_appIdentifier.png)
84