# Resource Manager Changelog ## cl.resourceManager.1 Name Change of Multi-Project APIs in API Version 9 The Resource Manager module can return error codes and error information for APIs in API version 9 and later. Some multi-project APIs in API version 9 need to be adapted. The following changes are made in API version 9: Some multi-project APIs of the Resource Manager are replaced with new APIs, but the parameters remain unchanged. **Change Impact** For applications developed based on earlier versions, relevant JavaScript multi-project APIs need to be replaced with new APIs. **Key API/Component Changes** | **Original API** | **New API**| | ---------------- | ------------ | | getString(resource: Resource,
callback: AsyncCallback\): void; | getStringValue(resource: Resource,
callback: AsyncCallback\): void; | | getString(resource: Resource): Promise\; | getStringValue(resource: Resource): Promise\; | | getStringArray(resource: Resource,
callback: AsyncCallback\>): void; | getStringArrayValue(resource: Resource,
callback: AsyncCallback\>): void; | | getStringArray(resource: Resource): Promise\>; | getStringArrayValue(resource: Resource): Promise\>; | | getMedia(resource: Resource,
callback: AsyncCallback\): void; | getMediaContent(resource: Resource,
callback: AsyncCallback\): void; | | getMedia(resource: Resource): Promise\; | getMediaContent(resource: Resource): Promise\; | | getMediaBase64(resource: Resource,
callback: AsyncCallback\): void; | getMediaContentBase64(resource: Resource,
callback: AsyncCallback\): void; | | getMediaBase64(resource: Resource): Promise\; | getMediaContentBase64(resource: Resource): Promise\; | | getPluralString(resource: Resource, num: number,
callback: AsyncCallback): void; | getPluralStringValue(resource: Resource, num: number,
callback: AsyncCallback\): void; | | getPluralString(resource: Resource, num: number): Promise\; | getPluralStringValue(resource: Resource, num: number): Promise\; | **Adaptation Guide** The following describes how to change **getMedia** to **getMediaContent** in callback mode. The promise mode is similar. You only need to change the function name, add the error code and error information, and keep other information unchanged. Example: - Before the change: **getMedia(resource: Resource, callback: AsyncCallback): void;** ```ts let resource = { bundleName: "com.example.myapplication", moduleName: "entry", id: $r('app.media.test').id }; this.context.resourceManager.getMedia(resource, (error, value) => { if (error != null) { console.log("error is " + error); } else { let media = value; } }); ``` - After the change: **getMediaContent(resource: Resource, callback: AsyncCallback): void;** ```ts let resource = { bundleName: "com.example.myapplication", moduleName: "entry", id: $r('app.media.test').id }; try { this.context.resourceManager.getMediaContent(resource, (error, value) => { if (error != null) { console.log("error is " + error); } else { let media = value; } }); } catch (error) { console.error(`callback getMediaContent failed, error code: ${error.code}, message: ${error.message}.`) } ```