1# bundle 2 3 4## Overview 5 6The bundle module provides APIs for querying application information. 7 8**System capability**: SystemCapability.BundleManager.BundleFramework.Core 9 10**Since**: 9 11 12 13## Summary 14 15 16### Files 17 18| Name| Description| 19| -------- | -------- | 20| [native_interface_bundle.h](native__interface__bundle.md) | Provides application information structs and functions.<br>**File to include**: <bundle/native_interface_bundle.h><br>**Library**: libbundle_ndk.z.so| 21 22 23### Structs 24 25| Name| Description| 26| -------- | -------- | 27| [OH_NativeBundle_ApplicationInfo](_o_h___native_bundle_application_info.md) | Describes the application information.| 28| [OH_NativeBundle_ElementName](_o_h___native_bundle_element_name.md) | Describes the application entry information.| 29| [OH_NativeBundle_Metadata](native_interface_bundle_metadata.md) | Describes the metadata of the application.| 30| [OH_NativeBundle_ModuleMetadata](native_interface_bundle_module_metadata.md) | Describes the module metadata of the application.| 31 32 33### Functions 34 35| Name| Description| 36| -------- | -------- | 37| [OH_NativeBundle_GetCurrentApplicationInfo](#oh_nativebundle_getcurrentapplicationinfo) | Obtains the current application information.| 38| [OH_NativeBundle_GetAppId](#oh_nativebundle_getappid) | Obtains the appId information about the current application.| 39| [OH_NativeBundle_GetAppIdentifier](#oh_nativebundle_getappidentifier) | Obtains the appIdentifier information about the current application.| 40| [OH_NativeBundle_GetMainElementName](#oh_nativebundle_getmainelementname) | Obtains the entry information about the current application.| 41| [OH_NativeBundle_GetCompatibleDeviceType](_bundle.md#oh_nativebundle_getcompatibledevicetype) | Obtains the compatible device type of the current application.| 42| [OH_NativeBundle_IsDebugMode](#oh_nativebundle_isdebugmode) | Checks whether the current application is in debug mode.| 43| [OH_NativeBundle_GetModuleMetadata](#oh_nativebundle_getmodulemetadata) | Obtains the metadata information of the application.| 44 45## Function Description 46 47 48### OH_NativeBundle_GetCurrentApplicationInfo() 49 50``` 51OH_NativeBundle_ApplicationInfo OH_NativeBundle_GetCurrentApplicationInfo() 52``` 53 54**Description** 55 56Obtains the current application information. 57 58**Since**: 9 59 60**Returns** 61 62Returns the [OH_NativeBundle_ApplicationInfo](_o_h___native_bundle_application_info.md) struct. 63 64### OH_NativeBundle_GetAppId() 65 66``` 67char* OH_NativeBundle_GetAppId() 68``` 69 70**Description** 71 72Obtains the appId information about the current application. 73 74**Since**: 11 75 76**Returns** 77 78Returns a string that describes the appId information of the application. 79 80### OH_NativeBundle_GetAppIdentifier() 81 82``` 83char* OH_NativeBundle_GetAppIdentifier() 84``` 85 86**Description** 87 88Obtains the appIdentifier information about the current application. appIdentifier is the unique ID of the application. It is the [app ID](https://developer.huawei.com/consumer/en/doc/app/agc-help-createharmonyapp-0000001945392297), which is a random string, allocated by AppGallery Connect during the creation of the application. This ID does not change along the application lifecycle, including version updates, certificate changes, public and private key changes, and application transfers. If you use multiple debugging devices, perform debugging offline, or need to interact with other applications, you are advised to use [manual signature](https://developer.huawei.com/consumer/en/doc/harmonyos-guides/ide-signing#section297715173233). 89 90**Since**: 11 91 92**Returns** 93 94Returns a string that describes the appIdentifier information of the application. 95 96### OH_NativeBundle_GetMainElementName() 97 98``` 99OH_NativeBundle_ElementName OH_NativeBundle_GetMainElementName() 100``` 101 102**Description** 103 104Obtains the application entry information, including the bundle name, module name, and ability name. 105 106**Since**: 13 107 108**Returns** 109 110Returns the [OH_NativeBundle_ElementName](_o_h___native_bundle_element_name.md) struct. 111 112### OH_NativeBundle_GetCompatibleDeviceType() 113 114``` 115char* OH_NativeBundle_GetCompatibleDeviceType() 116``` 117 118**Description** 119 120Obtains the compatible device type of the current application. It helps you optimize the layout and font size when distributing mobile applications to tablets or 2-in-1 devices. 121 122**Since**: 14 123 124**Returns** 125 126Returns a string indicating the compatible device type. 127 128### OH_NativeBundle_IsDebugMode 129 130``` 131bool OH_NativeBundle_IsDebugMode(bool* isDebugMode) 132``` 133 134**Description** 135 136Checks whether the current application is in debug mode. 137 138**Since**: 20 139 140**Parameters** 141 142| Name| Description| 143| -------- | -------- | 144| isDebugMode | Pointer to the check result. The value **true** means that the application is in debug mode, and **false** means the opposite.| 145 146**Returns** 147 148Operation result. The value **true** is returned if the call is successful, and **false** is returned otherwise. 149 150### OH_NativeBundle_GetModuleMetadata 151 152``` 153OH_NativeBundle_ModuleMetadata* OH_NativeBundle_GetModuleMetadata(size_t* size) 154``` 155 156**Description** 157 158Obtains the module metadata array of the current application. After using this function, you must manually release the pointer returned to prevent memory leakage. 159 160**Since**: 20 161 162**Parameters** 163 164| Name| Description| 165| -------- | -------- | 166| size | Pointer to the size of the module metadata array.| 167 168**Returns** 169 170An array of module metadata. If the returned object is NULL, the retrieval fails. 171 172The possible cause is that the application address space is full, causing space allocation to fail. 173