1# Bundle Manager Subsystem Changelog 2 3## cl.bundlemanager.1 Fields appId and appIdentifier Are Added to OH_NativeBundle_ApplicationInfo and Memory Must Be Manually Released 4 5**Access Level** 6 7Public 8 9**Reason for Change** 10 11The **appId** and **appIdentifier** fields are added to the [OH_NativeBundle_ApplicationInfo](../../../application-dev/reference/native-apis/_o_h___native_bundle_application_info.md) struct. 12 13**Change Impact** 14 15For a native application developed using API version 11 or later, you must manually release the memory allocated for the **appId** and **appIdentifier** fields in the **OH_NativeBundle_ApplicationInfo** struct; otherwise, memory leak occurs. If the native application is developed using APIs earlier than API version 11, no adaptation is required. 16 17**Change Since** 18 19OpenHarmony SDK 4.1.3.2 20 21**Key API/Component Changes** 22 23An application calls [OH_NativeBundle_GetCurrentApplicationInfo](../../../application-dev/reference/native-apis/native__interface__bundle.md#oh_nativebundle_getcurrentapplicationinfo) to query its own information. 24 25**Adaptation Guide** 26 27If your application is a native application developed using API version 11 or later, manually release the memory allocated for **appId** and **appIdentifier**. 28 29Sample code: 30 31 ```c++ 32 static napi_value GetCurrentApplicationInfo(napi_env env, napi_callback_info info) 33 { 34 // Call the native API to obtain the application information. 35 OH_NativeBundle_ApplicationInfo nativeApplicationInfo = OH_NativeBundle_GetCurrentApplicationInfo(); 36 napi_value result = nullptr; 37 napi_create_object(env, &result); 38 // Convert the bundle name obtained by calling the native API to the bundleName attribute in the JavaScript object. 39 napi_value bundleName; 40 napi_create_string_utf8(env, nativeApplicationInfo.bundleName, NAPI_AUTO_LENGTH, &bundleName); 41 napi_set_named_property(env, result, "bundleName", bundleName); 42 // Convert the fingerprint information obtained by calling the native API to the fingerprint attribute in the JavaScript object. 43 napi_value fingerprint; 44 napi_create_string_utf8(env, nativeApplicationInfo.fingerprint, NAPI_AUTO_LENGTH, &fingerprint); 45 napi_set_named_property(env, result, "fingerprint", fingerprint); 46 47 char* appId = OH_NativeBundle_GetAppId(); 48 // Convert the application ID obtained by calling the native API to the appId attribute in the JavaScript object. 49 napi_value napi_appId; 50 napi_create_string_utf8(env, appId, NAPI_AUTO_LENGTH, &napi_appId); 51 napi_set_named_property(env, result, "appId", napi_appId); 52 53 char* appIdentifier = OH_NativeBundle_GetAppIdentifier(); 54 // Convert the application identifier obtained by calling the native API to the appIdentifier attribute in the JavaScript object. 55 napi_value napi_appIdentifier; 56 napi_create_string_utf8(env, appIdentifier, NAPI_AUTO_LENGTH, &napi_appIdentifier); 57 napi_set_named_property(env, result, "appIdentifier", napi_appIdentifier); 58 // To prevent memory leak, manually release the memory. 59 free(nativeApplicationInfo.bundleName); 60 free(nativeApplicationInfo.fingerprint); 61 free(appId); 62 free(appIdentifier); 63 return result; 64 } 65``` 66 67For details, see [Native Bundle Development](../../../application-dev/napi/native-bundle-guidelines.md). 68