1# 资源管理<a name="ZH-CN_TOPIC_0000001163977082"></a> 2 3> **说明:** 4>从 API Version 6 开始支持。 5 6## 导入模块<a name="zh-cn_topic_0000001163468626_s56d19203690d4782bfc74069abb6bd71"></a> 7 8``` 9import resourceManager from '@ohos.resourceManager'; 10``` 11 12## 权限<a name="zh-cn_topic_0000001163468626_section11257113618419"></a> 13 14无 15 16## resourceManager.getResourceManager<a name="zh-cn_topic_0000001163468626_section192192415554"></a> 17 18getResourceManager\(callback: AsyncCallback<ResourceManager\>\): void 19 20获取当前应用的资源管理对象,使用callback形式返回ResourceManager对象。 21 22- 参数: 23 24 <a name="zh-cn_topic_0000001163468626_table69661135912"></a> 25 <table><thead align="left"><tr id="zh-cn_topic_0000001163468626_row149668318915"><th class="cellrowborder" valign="top" width="8.81%" id="mcps1.1.5.1.1"><p id="zh-cn_topic_0000001163468626_p7966738914"><a name="zh-cn_topic_0000001163468626_p7966738914"></a><a name="zh-cn_topic_0000001163468626_p7966738914"></a>参数名</p> 26 </th> 27 <th class="cellrowborder" valign="top" width="27.11%" id="mcps1.1.5.1.2"><p id="zh-cn_topic_0000001163468626_p296713699"><a name="zh-cn_topic_0000001163468626_p296713699"></a><a name="zh-cn_topic_0000001163468626_p296713699"></a>类型</p> 28 </th> 29 <th class="cellrowborder" valign="top" width="6.710000000000001%" id="mcps1.1.5.1.3"><p id="zh-cn_topic_0000001163468626_p196718315911"><a name="zh-cn_topic_0000001163468626_p196718315911"></a><a name="zh-cn_topic_0000001163468626_p196718315911"></a>必填</p> 30 </th> 31 <th class="cellrowborder" valign="top" width="57.37%" id="mcps1.1.5.1.4"><p id="zh-cn_topic_0000001163468626_p9967231197"><a name="zh-cn_topic_0000001163468626_p9967231197"></a><a name="zh-cn_topic_0000001163468626_p9967231197"></a>说明</p> 32 </th> 33 </tr> 34 </thead> 35 <tbody><tr id="zh-cn_topic_0000001163468626_row99671533914"><td class="cellrowborder" valign="top" width="8.81%" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001163468626_p13838351705"><a name="zh-cn_topic_0000001163468626_p13838351705"></a><a name="zh-cn_topic_0000001163468626_p13838351705"></a>callback</p> 36 </td> 37 <td class="cellrowborder" valign="top" width="27.11%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001163468626_p11967433914"><a name="zh-cn_topic_0000001163468626_p11967433914"></a><a name="zh-cn_topic_0000001163468626_p11967433914"></a>AsyncCallback<<a href="#zh-cn_topic_0000001163468626_section137771134135415">ResourceManager</a>></p> 38 </td> 39 <td class="cellrowborder" valign="top" width="6.710000000000001%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001163468626_p19671336916"><a name="zh-cn_topic_0000001163468626_p19671336916"></a><a name="zh-cn_topic_0000001163468626_p19671336916"></a>是</p> 40 </td> 41 <td class="cellrowborder" valign="top" width="57.37%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001163468626_p69671631796"><a name="zh-cn_topic_0000001163468626_p69671631796"></a><a name="zh-cn_topic_0000001163468626_p69671631796"></a>callback方式返回ResourceManager对象</p> 42 </td> 43 </tr> 44 </tbody> 45 </table> 46 47 48- 示例: 49 50 ``` 51 resourceManager.getResourceManager((error, mgr) => { 52 if (error != null) { 53 console.log("error occurs" + error); 54 return; 55 } 56 mgr.getString(0x1000000, (error, value) => { 57 if (error != null) { 58 console.log(value); 59 } else { 60 console.log(value); 61 } 62 }); 63 } 64 65 ``` 66 67 68## resourceManager.getResourceManager<a name="zh-cn_topic_0000001163468626_section46989284018"></a> 69 70getResourceManager\(bundleName: string, callback: AsyncCallback<ResourceManager\>\): void 71 72获取指定应用的资源管理对象,使用callback形式返回ResourceManager对象。 73 74- 参数: 75 76 <a name="zh-cn_topic_0000001163468626_table146992288015"></a> 77 <table><thead align="left"><tr id="zh-cn_topic_0000001163468626_row16994286017"><th class="cellrowborder" valign="top" width="11.119698579847357%" id="mcps1.1.5.1.1"><p id="zh-cn_topic_0000001163468626_p196991328500"><a name="zh-cn_topic_0000001163468626_p196991328500"></a><a name="zh-cn_topic_0000001163468626_p196991328500"></a>参数名</p> 78 </th> 79 <th class="cellrowborder" valign="top" width="22.905999420345864%" id="mcps1.1.5.1.2"><p id="zh-cn_topic_0000001163468626_p156991028607"><a name="zh-cn_topic_0000001163468626_p156991028607"></a><a name="zh-cn_topic_0000001163468626_p156991028607"></a>类型</p> 80 </th> 81 <th class="cellrowborder" valign="top" width="6.762631629794225%" id="mcps1.1.5.1.3"><p id="zh-cn_topic_0000001163468626_p569920281005"><a name="zh-cn_topic_0000001163468626_p569920281005"></a><a name="zh-cn_topic_0000001163468626_p569920281005"></a>必填</p> 82 </th> 83 <th class="cellrowborder" valign="top" width="59.211670370012556%" id="mcps1.1.5.1.4"><p id="zh-cn_topic_0000001163468626_p5699428800"><a name="zh-cn_topic_0000001163468626_p5699428800"></a><a name="zh-cn_topic_0000001163468626_p5699428800"></a>说明</p> 84 </th> 85 </tr> 86 </thead> 87 <tbody><tr id="zh-cn_topic_0000001163468626_row469912281801"><td class="cellrowborder" valign="top" width="11.119698579847357%" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001163468626_p46991028909"><a name="zh-cn_topic_0000001163468626_p46991028909"></a><a name="zh-cn_topic_0000001163468626_p46991028909"></a>bundleName</p> 88 </td> 89 <td class="cellrowborder" valign="top" width="22.905999420345864%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001163468626_p469919282017"><a name="zh-cn_topic_0000001163468626_p469919282017"></a><a name="zh-cn_topic_0000001163468626_p469919282017"></a>string</p> 90 </td> 91 <td class="cellrowborder" valign="top" width="6.762631629794225%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001163468626_p169982812013"><a name="zh-cn_topic_0000001163468626_p169982812013"></a><a name="zh-cn_topic_0000001163468626_p169982812013"></a>是</p> 92 </td> 93 <td class="cellrowborder" valign="top" width="59.211670370012556%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001163468626_p569972818014"><a name="zh-cn_topic_0000001163468626_p569972818014"></a><a name="zh-cn_topic_0000001163468626_p569972818014"></a>指定应用的Bundle名称</p> 94 </td> 95 </tr> 96 <tr id="zh-cn_topic_0000001163468626_row769982815012"><td class="cellrowborder" valign="top" width="11.119698579847357%" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001163468626_p10188114718716"><a name="zh-cn_topic_0000001163468626_p10188114718716"></a><a name="zh-cn_topic_0000001163468626_p10188114718716"></a>callback</p> 97 </td> 98 <td class="cellrowborder" valign="top" width="22.905999420345864%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001163468626_p1518810471873"><a name="zh-cn_topic_0000001163468626_p1518810471873"></a><a name="zh-cn_topic_0000001163468626_p1518810471873"></a>AsyncCallback<<a href="#zh-cn_topic_0000001163468626_section137771134135415">ResourceManager</a>></p> 99 </td> 100 <td class="cellrowborder" valign="top" width="6.762631629794225%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001163468626_p718813478713"><a name="zh-cn_topic_0000001163468626_p718813478713"></a><a name="zh-cn_topic_0000001163468626_p718813478713"></a>是</p> 101 </td> 102 <td class="cellrowborder" valign="top" width="59.211670370012556%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001163468626_p1618844718710"><a name="zh-cn_topic_0000001163468626_p1618844718710"></a><a name="zh-cn_topic_0000001163468626_p1618844718710"></a>callback方式返回ResourceManager对象</p> 103 </td> 104 </tr> 105 </tbody> 106 </table> 107 108- 示例: 109 110 ``` 111 resourceManager.getResourceManager("com.example.myapplication", (error, mgr) => { 112 } 113 ``` 114 115 116## resourceManager.getResourceManager<a name="zh-cn_topic_0000001163468626_section0543541673"></a> 117 118getResourceManager\(\): Promise<ResourceManager\> 119 120获取当前应用的资源管理对象,使用Promise形式返回ResourceManager对象。 121 122- 返回值: 123 124 <a name="zh-cn_topic_0000001163468626_table125442040718"></a> 125 <table><thead align="left"><tr id="zh-cn_topic_0000001163468626_row11545745715"><th class="cellrowborder" valign="top" width="21.19%" id="mcps1.1.3.1.1"><p id="zh-cn_topic_0000001163468626_p115451947716"><a name="zh-cn_topic_0000001163468626_p115451947716"></a><a name="zh-cn_topic_0000001163468626_p115451947716"></a>类型</p> 126 </th> 127 <th class="cellrowborder" valign="top" width="78.81%" id="mcps1.1.3.1.2"><p id="zh-cn_topic_0000001163468626_p15451043716"><a name="zh-cn_topic_0000001163468626_p15451043716"></a><a name="zh-cn_topic_0000001163468626_p15451043716"></a>说明</p> 128 </th> 129 </tr> 130 </thead> 131 <tbody><tr id="zh-cn_topic_0000001163468626_row55451841670"><td class="cellrowborder" valign="top" width="21.19%" headers="mcps1.1.3.1.1 "><p id="zh-cn_topic_0000001163468626_p135451841712"><a name="zh-cn_topic_0000001163468626_p135451841712"></a><a name="zh-cn_topic_0000001163468626_p135451841712"></a>Promise<<a href="#zh-cn_topic_0000001163468626_section137771134135415">ResourceManager</a>></p> 132 </td> 133 <td class="cellrowborder" valign="top" width="78.81%" headers="mcps1.1.3.1.2 "><p id="zh-cn_topic_0000001163468626_p954512419714"><a name="zh-cn_topic_0000001163468626_p954512419714"></a><a name="zh-cn_topic_0000001163468626_p954512419714"></a>Promise方式返回资源管理对象</p> 134 </td> 135 </tr> 136 </tbody> 137 </table> 138 139- 示例: 140 141 ``` 142 resourceManager.getResourceManager().then(mgr => { 143 mgr.getString(0x1000000, (error, value) => { 144 if (error != null) { 145 console.log(value); 146 } else { 147 console.log(value); 148 } 149 }); 150 }).catch(error => { 151 console.log(error); 152 }); 153 ``` 154 155 156## resourceManager.getResourceManager<a name="zh-cn_topic_0000001163468626_section1816951410716"></a> 157 158getResourceManager\(bundleName: string\): Promise<ResourceManager\> 159 160获取指定应用的资源管理对象,使用Promise形式返回ResourceManager对象。 161 162- 参数: 163 164 <a name="zh-cn_topic_0000001163468626_table6169161415710"></a> 165 <table><thead align="left"><tr id="zh-cn_topic_0000001163468626_row141691914878"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="zh-cn_topic_0000001163468626_p191691114172"><a name="zh-cn_topic_0000001163468626_p191691114172"></a><a name="zh-cn_topic_0000001163468626_p191691114172"></a>参数名</p> 166 </th> 167 <th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="zh-cn_topic_0000001163468626_p91690141774"><a name="zh-cn_topic_0000001163468626_p91690141774"></a><a name="zh-cn_topic_0000001163468626_p91690141774"></a>类型</p> 168 </th> 169 <th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="zh-cn_topic_0000001163468626_p1417013141074"><a name="zh-cn_topic_0000001163468626_p1417013141074"></a><a name="zh-cn_topic_0000001163468626_p1417013141074"></a>必填</p> 170 </th> 171 <th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="zh-cn_topic_0000001163468626_p1117051418716"><a name="zh-cn_topic_0000001163468626_p1117051418716"></a><a name="zh-cn_topic_0000001163468626_p1117051418716"></a>说明</p> 172 </th> 173 </tr> 174 </thead> 175 <tbody><tr id="zh-cn_topic_0000001163468626_row1917061417717"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001163468626_p16466037131616"><a name="zh-cn_topic_0000001163468626_p16466037131616"></a><a name="zh-cn_topic_0000001163468626_p16466037131616"></a>bundleName</p> 176 </td> 177 <td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001163468626_p8466637101620"><a name="zh-cn_topic_0000001163468626_p8466637101620"></a><a name="zh-cn_topic_0000001163468626_p8466637101620"></a>string</p> 178 </td> 179 <td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001163468626_p446633713162"><a name="zh-cn_topic_0000001163468626_p446633713162"></a><a name="zh-cn_topic_0000001163468626_p446633713162"></a>是</p> 180 </td> 181 <td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001163468626_p1446633701612"><a name="zh-cn_topic_0000001163468626_p1446633701612"></a><a name="zh-cn_topic_0000001163468626_p1446633701612"></a>指定应用的Bundle名称</p> 182 </td> 183 </tr> 184 </tbody> 185 </table> 186 187- 返回值: 188 189 <a name="zh-cn_topic_0000001163468626_table51715149717"></a> 190 <table><thead align="left"><tr id="zh-cn_topic_0000001163468626_row717151413717"><th class="cellrowborder" valign="top" width="22.759999999999998%" id="mcps1.1.3.1.1"><p id="zh-cn_topic_0000001163468626_p917117141075"><a name="zh-cn_topic_0000001163468626_p917117141075"></a><a name="zh-cn_topic_0000001163468626_p917117141075"></a>类型</p> 191 </th> 192 <th class="cellrowborder" valign="top" width="77.24%" id="mcps1.1.3.1.2"><p id="zh-cn_topic_0000001163468626_p131716141778"><a name="zh-cn_topic_0000001163468626_p131716141778"></a><a name="zh-cn_topic_0000001163468626_p131716141778"></a>说明</p> 193 </th> 194 </tr> 195 </thead> 196 <tbody><tr id="zh-cn_topic_0000001163468626_row1417116141579"><td class="cellrowborder" valign="top" width="22.759999999999998%" headers="mcps1.1.3.1.1 "><p id="zh-cn_topic_0000001163468626_p1940551651713"><a name="zh-cn_topic_0000001163468626_p1940551651713"></a><a name="zh-cn_topic_0000001163468626_p1940551651713"></a>Promise<<a href="#zh-cn_topic_0000001163468626_section137771134135415">ResourceManager</a>></p> 197 </td> 198 <td class="cellrowborder" valign="top" width="77.24%" headers="mcps1.1.3.1.2 "><p id="zh-cn_topic_0000001163468626_p140517164171"><a name="zh-cn_topic_0000001163468626_p140517164171"></a><a name="zh-cn_topic_0000001163468626_p140517164171"></a>Promise方式返回的资源管理对象</p> 199 </td> 200 </tr> 201 </tbody> 202 </table> 203 204- 示例: 205 206 ``` 207 resourceManager.getResourceManager("com.example.myapplication").then(mgr => { 208 209 }).catch(error => { 210 211 }); 212 ``` 213 214 215## Direction<a name="zh-cn_topic_0000001163468626_section099619567453"></a> 216 217用于表示设备屏幕方向。 218 219<a name="zh-cn_topic_0000001163468626_table20633101642315"></a> 220<table><thead align="left"><tr id="zh-cn_topic_0000001163468626_row663331618238"><th class="cellrowborder" valign="top" width="27.900000000000002%" id="mcps1.1.4.1.1"><p id="zh-cn_topic_0000001163468626_a3d0fc780cc904c1cbab7991251622f65"><a name="zh-cn_topic_0000001163468626_a3d0fc780cc904c1cbab7991251622f65"></a><a name="zh-cn_topic_0000001163468626_a3d0fc780cc904c1cbab7991251622f65"></a>名称</p> 221</th> 222<th class="cellrowborder" valign="top" width="12.43%" id="mcps1.1.4.1.2"><p id="zh-cn_topic_0000001163468626_aace9cae4ba0d4939bfa048460f61c3c7"><a name="zh-cn_topic_0000001163468626_aace9cae4ba0d4939bfa048460f61c3c7"></a><a name="zh-cn_topic_0000001163468626_aace9cae4ba0d4939bfa048460f61c3c7"></a>默认值</p> 223</th> 224<th class="cellrowborder" valign="top" width="59.67%" id="mcps1.1.4.1.3"><p id="zh-cn_topic_0000001163468626_afec895de33f94e3c87ee7acc20190a17"><a name="zh-cn_topic_0000001163468626_afec895de33f94e3c87ee7acc20190a17"></a><a name="zh-cn_topic_0000001163468626_afec895de33f94e3c87ee7acc20190a17"></a>说明</p> 225</th> 226</tr> 227</thead> 228<tbody><tr id="zh-cn_topic_0000001163468626_row188481425182510"><td class="cellrowborder" valign="top" width="27.900000000000002%" headers="mcps1.1.4.1.1 "><p id="zh-cn_topic_0000001163468626_p26821854218"><a name="zh-cn_topic_0000001163468626_p26821854218"></a><a name="zh-cn_topic_0000001163468626_p26821854218"></a>DIRECTION_VERTICAL</p> 229</td> 230<td class="cellrowborder" valign="top" width="12.43%" headers="mcps1.1.4.1.2 "><p id="zh-cn_topic_0000001163468626_p2282152962115"><a name="zh-cn_topic_0000001163468626_p2282152962115"></a><a name="zh-cn_topic_0000001163468626_p2282152962115"></a>0</p> 231</td> 232<td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="zh-cn_topic_0000001163468626_p328012293211"><a name="zh-cn_topic_0000001163468626_p328012293211"></a><a name="zh-cn_topic_0000001163468626_p328012293211"></a>竖屏</p> 233</td> 234</tr> 235<tr id="zh-cn_topic_0000001163468626_row0461622112513"><td class="cellrowborder" valign="top" width="27.900000000000002%" headers="mcps1.1.4.1.1 "><p id="zh-cn_topic_0000001163468626_p12106173918219"><a name="zh-cn_topic_0000001163468626_p12106173918219"></a><a name="zh-cn_topic_0000001163468626_p12106173918219"></a>DIRECTION_HORIZONTAL</p> 236</td> 237<td class="cellrowborder" valign="top" width="12.43%" headers="mcps1.1.4.1.2 "><p id="zh-cn_topic_0000001163468626_p1310553911218"><a name="zh-cn_topic_0000001163468626_p1310553911218"></a><a name="zh-cn_topic_0000001163468626_p1310553911218"></a>1</p> 238</td> 239<td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="zh-cn_topic_0000001163468626_p15865395215"><a name="zh-cn_topic_0000001163468626_p15865395215"></a><a name="zh-cn_topic_0000001163468626_p15865395215"></a>横屏</p> 240</td> 241</tr> 242</tbody> 243</table> 244 245## DeviceType<a name="zh-cn_topic_0000001163468626_section4734636131914"></a> 246 247用于表示当前设备类型。 248 249<a name="zh-cn_topic_0000001163468626_table873411360193"></a> 250<table><thead align="left"><tr id="zh-cn_topic_0000001163468626_row187341036191911"><th class="cellrowborder" valign="top" width="27.900000000000002%" id="mcps1.1.4.1.1"><p id="zh-cn_topic_0000001163468626_p19735163661915"><a name="zh-cn_topic_0000001163468626_p19735163661915"></a><a name="zh-cn_topic_0000001163468626_p19735163661915"></a>名称</p> 251</th> 252<th class="cellrowborder" valign="top" width="12.43%" id="mcps1.1.4.1.2"><p id="zh-cn_topic_0000001163468626_p12735173661913"><a name="zh-cn_topic_0000001163468626_p12735173661913"></a><a name="zh-cn_topic_0000001163468626_p12735173661913"></a>默认值</p> 253</th> 254<th class="cellrowborder" valign="top" width="59.67%" id="mcps1.1.4.1.3"><p id="zh-cn_topic_0000001163468626_p12735163611913"><a name="zh-cn_topic_0000001163468626_p12735163611913"></a><a name="zh-cn_topic_0000001163468626_p12735163611913"></a>说明</p> 255</th> 256</tr> 257</thead> 258<tbody><tr id="zh-cn_topic_0000001163468626_row19735113619194"><td class="cellrowborder" valign="top" width="27.900000000000002%" headers="mcps1.1.4.1.1 "><p id="zh-cn_topic_0000001163468626_p27351736111919"><a name="zh-cn_topic_0000001163468626_p27351736111919"></a><a name="zh-cn_topic_0000001163468626_p27351736111919"></a>DEVICE_TYPE_PHONE</p> 259</td> 260<td class="cellrowborder" valign="top" width="12.43%" headers="mcps1.1.4.1.2 "><p id="zh-cn_topic_0000001163468626_p137351636131917"><a name="zh-cn_topic_0000001163468626_p137351636131917"></a><a name="zh-cn_topic_0000001163468626_p137351636131917"></a>0x00</p> 261</td> 262<td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="zh-cn_topic_0000001163468626_p1873543614192"><a name="zh-cn_topic_0000001163468626_p1873543614192"></a><a name="zh-cn_topic_0000001163468626_p1873543614192"></a>手机.</p> 263</td> 264</tr> 265<tr id="zh-cn_topic_0000001163468626_row1956619491229"><td class="cellrowborder" valign="top" width="27.900000000000002%" headers="mcps1.1.4.1.1 "><p id="zh-cn_topic_0000001163468626_p1456634917225"><a name="zh-cn_topic_0000001163468626_p1456634917225"></a><a name="zh-cn_topic_0000001163468626_p1456634917225"></a>DEVICE_TYPE_TABLET</p> 266</td> 267<td class="cellrowborder" valign="top" width="12.43%" headers="mcps1.1.4.1.2 "><p id="zh-cn_topic_0000001163468626_p1256634982217"><a name="zh-cn_topic_0000001163468626_p1256634982217"></a><a name="zh-cn_topic_0000001163468626_p1256634982217"></a>0x01</p> 268</td> 269<td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="zh-cn_topic_0000001163468626_p598213916331"><a name="zh-cn_topic_0000001163468626_p598213916331"></a><a name="zh-cn_topic_0000001163468626_p598213916331"></a>平板</p> 270</td> 271</tr> 272<tr id="zh-cn_topic_0000001163468626_row57811744162211"><td class="cellrowborder" valign="top" width="27.900000000000002%" headers="mcps1.1.4.1.1 "><p id="zh-cn_topic_0000001163468626_p47820449225"><a name="zh-cn_topic_0000001163468626_p47820449225"></a><a name="zh-cn_topic_0000001163468626_p47820449225"></a>DEVICE_TYPE_CAR</p> 273</td> 274<td class="cellrowborder" valign="top" width="12.43%" headers="mcps1.1.4.1.2 "><p id="zh-cn_topic_0000001163468626_p1878244417224"><a name="zh-cn_topic_0000001163468626_p1878244417224"></a><a name="zh-cn_topic_0000001163468626_p1878244417224"></a>0x02</p> 275</td> 276<td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="zh-cn_topic_0000001163468626_p378213446229"><a name="zh-cn_topic_0000001163468626_p378213446229"></a><a name="zh-cn_topic_0000001163468626_p378213446229"></a>汽车</p> 277</td> 278</tr> 279<tr id="zh-cn_topic_0000001163468626_row578284442218"><td class="cellrowborder" valign="top" width="27.900000000000002%" headers="mcps1.1.4.1.1 "><p id="zh-cn_topic_0000001163468626_p117821445229"><a name="zh-cn_topic_0000001163468626_p117821445229"></a><a name="zh-cn_topic_0000001163468626_p117821445229"></a>DEVICE_TYPE_PC</p> 280</td> 281<td class="cellrowborder" valign="top" width="12.43%" headers="mcps1.1.4.1.2 "><p id="zh-cn_topic_0000001163468626_p137821044172214"><a name="zh-cn_topic_0000001163468626_p137821044172214"></a><a name="zh-cn_topic_0000001163468626_p137821044172214"></a>0x03</p> 282</td> 283<td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="zh-cn_topic_0000001163468626_p18782124422219"><a name="zh-cn_topic_0000001163468626_p18782124422219"></a><a name="zh-cn_topic_0000001163468626_p18782124422219"></a>电脑</p> 284</td> 285</tr> 286<tr id="zh-cn_topic_0000001163468626_row84751140142210"><td class="cellrowborder" valign="top" width="27.900000000000002%" headers="mcps1.1.4.1.1 "><p id="zh-cn_topic_0000001163468626_p0475184014225"><a name="zh-cn_topic_0000001163468626_p0475184014225"></a><a name="zh-cn_topic_0000001163468626_p0475184014225"></a>DEVICE_TYPE_TV</p> 287</td> 288<td class="cellrowborder" valign="top" width="12.43%" headers="mcps1.1.4.1.2 "><p id="zh-cn_topic_0000001163468626_p1847519407228"><a name="zh-cn_topic_0000001163468626_p1847519407228"></a><a name="zh-cn_topic_0000001163468626_p1847519407228"></a>0x04</p> 289</td> 290<td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="zh-cn_topic_0000001163468626_p44757409225"><a name="zh-cn_topic_0000001163468626_p44757409225"></a><a name="zh-cn_topic_0000001163468626_p44757409225"></a>电视</p> 291</td> 292</tr> 293<tr id="zh-cn_topic_0000001163468626_row9735736161917"><td class="cellrowborder" valign="top" width="27.900000000000002%" headers="mcps1.1.4.1.1 "><p id="zh-cn_topic_0000001163468626_p2073520364190"><a name="zh-cn_topic_0000001163468626_p2073520364190"></a><a name="zh-cn_topic_0000001163468626_p2073520364190"></a>DEVICE_TYPE_WEARABLE</p> 294</td> 295<td class="cellrowborder" valign="top" width="12.43%" headers="mcps1.1.4.1.2 "><p id="zh-cn_topic_0000001163468626_p1273683612191"><a name="zh-cn_topic_0000001163468626_p1273683612191"></a><a name="zh-cn_topic_0000001163468626_p1273683612191"></a>0x06</p> 296</td> 297<td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="zh-cn_topic_0000001163468626_p1873653617198"><a name="zh-cn_topic_0000001163468626_p1873653617198"></a><a name="zh-cn_topic_0000001163468626_p1873653617198"></a>穿戴</p> 298</td> 299</tr> 300</tbody> 301</table> 302 303## ScreenDensity<a name="zh-cn_topic_0000001163468626_section7331173812197"></a> 304 305用于表示当前设备屏幕密度。 306 307<a name="zh-cn_topic_0000001163468626_table203311638181919"></a> 308<table><thead align="left"><tr id="zh-cn_topic_0000001163468626_row33311338101917"><th class="cellrowborder" valign="top" width="27.900000000000002%" id="mcps1.1.4.1.1"><p id="zh-cn_topic_0000001163468626_p733183811195"><a name="zh-cn_topic_0000001163468626_p733183811195"></a><a name="zh-cn_topic_0000001163468626_p733183811195"></a>名称</p> 309</th> 310<th class="cellrowborder" valign="top" width="12.42%" id="mcps1.1.4.1.2"><p id="zh-cn_topic_0000001163468626_p1331163810197"><a name="zh-cn_topic_0000001163468626_p1331163810197"></a><a name="zh-cn_topic_0000001163468626_p1331163810197"></a>默认值</p> 311</th> 312<th class="cellrowborder" valign="top" width="59.68%" id="mcps1.1.4.1.3"><p id="zh-cn_topic_0000001163468626_p10331238191920"><a name="zh-cn_topic_0000001163468626_p10331238191920"></a><a name="zh-cn_topic_0000001163468626_p10331238191920"></a>说明</p> 313</th> 314</tr> 315</thead> 316<tbody><tr id="zh-cn_topic_0000001163468626_row19331163821912"><td class="cellrowborder" valign="top" width="27.900000000000002%" headers="mcps1.1.4.1.1 "><p id="zh-cn_topic_0000001163468626_p133311538131919"><a name="zh-cn_topic_0000001163468626_p133311538131919"></a><a name="zh-cn_topic_0000001163468626_p133311538131919"></a>SCREEN_SDPI</p> 317</td> 318<td class="cellrowborder" valign="top" width="12.42%" headers="mcps1.1.4.1.2 "><p id="zh-cn_topic_0000001163468626_p833113385195"><a name="zh-cn_topic_0000001163468626_p833113385195"></a><a name="zh-cn_topic_0000001163468626_p833113385195"></a>120</p> 319</td> 320<td class="cellrowborder" valign="top" width="59.68%" headers="mcps1.1.4.1.3 "><p id="zh-cn_topic_0000001163468626_p1133133881918"><a name="zh-cn_topic_0000001163468626_p1133133881918"></a><a name="zh-cn_topic_0000001163468626_p1133133881918"></a>小规模的屏幕密度</p> 321</td> 322</tr> 323<tr id="zh-cn_topic_0000001163468626_row1399293473011"><td class="cellrowborder" valign="top" width="27.900000000000002%" headers="mcps1.1.4.1.1 "><p id="zh-cn_topic_0000001163468626_p599213418300"><a name="zh-cn_topic_0000001163468626_p599213418300"></a><a name="zh-cn_topic_0000001163468626_p599213418300"></a>SCREEN_MDPI</p> 324</td> 325<td class="cellrowborder" valign="top" width="12.42%" headers="mcps1.1.4.1.2 "><p id="zh-cn_topic_0000001163468626_p1099210349304"><a name="zh-cn_topic_0000001163468626_p1099210349304"></a><a name="zh-cn_topic_0000001163468626_p1099210349304"></a>160</p> 326</td> 327<td class="cellrowborder" valign="top" width="59.68%" headers="mcps1.1.4.1.3 "><p id="zh-cn_topic_0000001163468626_p139921534173016"><a name="zh-cn_topic_0000001163468626_p139921534173016"></a><a name="zh-cn_topic_0000001163468626_p139921534173016"></a>中规模的屏幕密度</p> 328</td> 329</tr> 330<tr id="zh-cn_topic_0000001163468626_row4841123016304"><td class="cellrowborder" valign="top" width="27.900000000000002%" headers="mcps1.1.4.1.1 "><p id="zh-cn_topic_0000001163468626_p188417305309"><a name="zh-cn_topic_0000001163468626_p188417305309"></a><a name="zh-cn_topic_0000001163468626_p188417305309"></a>SCREEN_LDPI</p> 331</td> 332<td class="cellrowborder" valign="top" width="12.42%" headers="mcps1.1.4.1.2 "><p id="zh-cn_topic_0000001163468626_p10841193014308"><a name="zh-cn_topic_0000001163468626_p10841193014308"></a><a name="zh-cn_topic_0000001163468626_p10841193014308"></a>240</p> 333</td> 334<td class="cellrowborder" valign="top" width="59.68%" headers="mcps1.1.4.1.3 "><p id="zh-cn_topic_0000001163468626_p1084116309304"><a name="zh-cn_topic_0000001163468626_p1084116309304"></a><a name="zh-cn_topic_0000001163468626_p1084116309304"></a>大规模的屏幕密度</p> 335</td> 336</tr> 337<tr id="zh-cn_topic_0000001163468626_row1784163013302"><td class="cellrowborder" valign="top" width="27.900000000000002%" headers="mcps1.1.4.1.1 "><p id="zh-cn_topic_0000001163468626_p48413309304"><a name="zh-cn_topic_0000001163468626_p48413309304"></a><a name="zh-cn_topic_0000001163468626_p48413309304"></a>SCREEN_XLDPI</p> 338</td> 339<td class="cellrowborder" valign="top" width="12.42%" headers="mcps1.1.4.1.2 "><p id="zh-cn_topic_0000001163468626_p128411930183011"><a name="zh-cn_topic_0000001163468626_p128411930183011"></a><a name="zh-cn_topic_0000001163468626_p128411930183011"></a>320</p> 340</td> 341<td class="cellrowborder" valign="top" width="59.68%" headers="mcps1.1.4.1.3 "><p id="zh-cn_topic_0000001163468626_p084110301309"><a name="zh-cn_topic_0000001163468626_p084110301309"></a><a name="zh-cn_topic_0000001163468626_p084110301309"></a>特大规模的屏幕密度</p> 342</td> 343</tr> 344<tr id="zh-cn_topic_0000001163468626_row1084092610308"><td class="cellrowborder" valign="top" width="27.900000000000002%" headers="mcps1.1.4.1.1 "><p id="zh-cn_topic_0000001163468626_p128411926173012"><a name="zh-cn_topic_0000001163468626_p128411926173012"></a><a name="zh-cn_topic_0000001163468626_p128411926173012"></a>SCREEN_XXLDPI</p> 345</td> 346<td class="cellrowborder" valign="top" width="12.42%" headers="mcps1.1.4.1.2 "><p id="zh-cn_topic_0000001163468626_p884192693019"><a name="zh-cn_topic_0000001163468626_p884192693019"></a><a name="zh-cn_topic_0000001163468626_p884192693019"></a>480</p> 347</td> 348<td class="cellrowborder" valign="top" width="59.68%" headers="mcps1.1.4.1.3 "><p id="zh-cn_topic_0000001163468626_p6841226163015"><a name="zh-cn_topic_0000001163468626_p6841226163015"></a><a name="zh-cn_topic_0000001163468626_p6841226163015"></a>超大规模的屏幕密度</p> 349</td> 350</tr> 351<tr id="zh-cn_topic_0000001163468626_row11331163891916"><td class="cellrowborder" valign="top" width="27.900000000000002%" headers="mcps1.1.4.1.1 "><p id="zh-cn_topic_0000001163468626_p14331163861914"><a name="zh-cn_topic_0000001163468626_p14331163861914"></a><a name="zh-cn_topic_0000001163468626_p14331163861914"></a>SCREEN_XXXLDPI</p> 352</td> 353<td class="cellrowborder" valign="top" width="12.42%" headers="mcps1.1.4.1.2 "><p id="zh-cn_topic_0000001163468626_p933115383192"><a name="zh-cn_topic_0000001163468626_p933115383192"></a><a name="zh-cn_topic_0000001163468626_p933115383192"></a>640</p> 354</td> 355<td class="cellrowborder" valign="top" width="59.68%" headers="mcps1.1.4.1.3 "><p id="zh-cn_topic_0000001163468626_p199356496257"><a name="zh-cn_topic_0000001163468626_p199356496257"></a><a name="zh-cn_topic_0000001163468626_p199356496257"></a>超特大规模的屏幕密度</p> 356</td> 357</tr> 358</tbody> 359</table> 360 361## Configuration<a name="zh-cn_topic_0000001163468626_section12882825611"></a> 362 363表示当前设备的状态。 364 365### 属性<a name="zh-cn_topic_0000001163468626_section254242964810"></a> 366 367<a name="zh-cn_topic_0000001163468626_table1459620431636"></a> 368<table><thead align="left"><tr id="zh-cn_topic_0000001163468626_row25971143435"><th class="cellrowborder" valign="top" width="15.870000000000001%" id="mcps1.1.6.1.1"><p id="zh-cn_topic_0000001163468626_p1559716434320"><a name="zh-cn_topic_0000001163468626_p1559716434320"></a><a name="zh-cn_topic_0000001163468626_p1559716434320"></a>名称</p> 369</th> 370<th class="cellrowborder" valign="top" width="10.86%" id="mcps1.1.6.1.2"><p id="zh-cn_topic_0000001163468626_p3597743539"><a name="zh-cn_topic_0000001163468626_p3597743539"></a><a name="zh-cn_topic_0000001163468626_p3597743539"></a>参数类型</p> 371</th> 372<th class="cellrowborder" valign="top" width="9.34%" id="mcps1.1.6.1.3"><p id="zh-cn_topic_0000001163468626_p15971343131"><a name="zh-cn_topic_0000001163468626_p15971343131"></a><a name="zh-cn_topic_0000001163468626_p15971343131"></a>可读</p> 373</th> 374<th class="cellrowborder" valign="top" width="11.51%" id="mcps1.1.6.1.4"><p id="zh-cn_topic_0000001163468626_p1459715436311"><a name="zh-cn_topic_0000001163468626_p1459715436311"></a><a name="zh-cn_topic_0000001163468626_p1459715436311"></a>可写</p> 375</th> 376<th class="cellrowborder" valign="top" width="52.42%" id="mcps1.1.6.1.5"><p id="zh-cn_topic_0000001163468626_p75975439316"><a name="zh-cn_topic_0000001163468626_p75975439316"></a><a name="zh-cn_topic_0000001163468626_p75975439316"></a>说明</p> 377</th> 378</tr> 379</thead> 380<tbody><tr id="zh-cn_topic_0000001163468626_row95971943839"><td class="cellrowborder" valign="top" width="15.870000000000001%" headers="mcps1.1.6.1.1 "><p id="zh-cn_topic_0000001163468626_p85976431431"><a name="zh-cn_topic_0000001163468626_p85976431431"></a><a name="zh-cn_topic_0000001163468626_p85976431431"></a>direction</p> 381</td> 382<td class="cellrowborder" valign="top" width="10.86%" headers="mcps1.1.6.1.2 "><p id="zh-cn_topic_0000001163468626_p2059710431030"><a name="zh-cn_topic_0000001163468626_p2059710431030"></a><a name="zh-cn_topic_0000001163468626_p2059710431030"></a><a href="#zh-cn_topic_0000001163468626_section099619567453">Direction</a></p> 383</td> 384<td class="cellrowborder" valign="top" width="9.34%" headers="mcps1.1.6.1.3 "><p id="zh-cn_topic_0000001163468626_p1059711439317"><a name="zh-cn_topic_0000001163468626_p1059711439317"></a><a name="zh-cn_topic_0000001163468626_p1059711439317"></a>是</p> 385</td> 386<td class="cellrowborder" valign="top" width="11.51%" headers="mcps1.1.6.1.4 "><p id="zh-cn_topic_0000001163468626_p659715430317"><a name="zh-cn_topic_0000001163468626_p659715430317"></a><a name="zh-cn_topic_0000001163468626_p659715430317"></a>否</p> 387</td> 388<td class="cellrowborder" valign="top" width="52.42%" headers="mcps1.1.6.1.5 "><p id="zh-cn_topic_0000001163468626_p2059719436313"><a name="zh-cn_topic_0000001163468626_p2059719436313"></a><a name="zh-cn_topic_0000001163468626_p2059719436313"></a>当前设备屏幕方向</p> 389</td> 390</tr> 391<tr id="zh-cn_topic_0000001163468626_row185973435316"><td class="cellrowborder" valign="top" width="15.870000000000001%" headers="mcps1.1.6.1.1 "><p id="zh-cn_topic_0000001163468626_p1559710432310"><a name="zh-cn_topic_0000001163468626_p1559710432310"></a><a name="zh-cn_topic_0000001163468626_p1559710432310"></a>locale</p> 392</td> 393<td class="cellrowborder" valign="top" width="10.86%" headers="mcps1.1.6.1.2 "><p id="zh-cn_topic_0000001163468626_p16597144318312"><a name="zh-cn_topic_0000001163468626_p16597144318312"></a><a name="zh-cn_topic_0000001163468626_p16597144318312"></a>string</p> 394</td> 395<td class="cellrowborder" valign="top" width="9.34%" headers="mcps1.1.6.1.3 "><p id="zh-cn_topic_0000001163468626_p12597194313317"><a name="zh-cn_topic_0000001163468626_p12597194313317"></a><a name="zh-cn_topic_0000001163468626_p12597194313317"></a>是</p> 396</td> 397<td class="cellrowborder" valign="top" width="11.51%" headers="mcps1.1.6.1.4 "><p id="zh-cn_topic_0000001163468626_p1259710431236"><a name="zh-cn_topic_0000001163468626_p1259710431236"></a><a name="zh-cn_topic_0000001163468626_p1259710431236"></a>否</p> 398</td> 399<td class="cellrowborder" valign="top" width="52.42%" headers="mcps1.1.6.1.5 "><p id="zh-cn_topic_0000001163468626_p10597843034"><a name="zh-cn_topic_0000001163468626_p10597843034"></a><a name="zh-cn_topic_0000001163468626_p10597843034"></a>当前系统语言</p> 400</td> 401</tr> 402</tbody> 403</table> 404 405## DeviceCapability<a name="zh-cn_topic_0000001163468626_section7200123494410"></a> 406 407表示设备支持的能力。 408 409### 属性<a name="zh-cn_topic_0000001163468626_section2201153419440"></a> 410 411<a name="zh-cn_topic_0000001163468626_table16201103444414"></a> 412<table><thead align="left"><tr id="zh-cn_topic_0000001163468626_row620123444415"><th class="cellrowborder" valign="top" width="15.870000000000001%" id="mcps1.1.6.1.1"><p id="zh-cn_topic_0000001163468626_p1620163494418"><a name="zh-cn_topic_0000001163468626_p1620163494418"></a><a name="zh-cn_topic_0000001163468626_p1620163494418"></a>名称</p> 413</th> 414<th class="cellrowborder" valign="top" width="10.86%" id="mcps1.1.6.1.2"><p id="zh-cn_topic_0000001163468626_p15201434124418"><a name="zh-cn_topic_0000001163468626_p15201434124418"></a><a name="zh-cn_topic_0000001163468626_p15201434124418"></a>参数类型</p> 415</th> 416<th class="cellrowborder" valign="top" width="9.34%" id="mcps1.1.6.1.3"><p id="zh-cn_topic_0000001163468626_p13201123484412"><a name="zh-cn_topic_0000001163468626_p13201123484412"></a><a name="zh-cn_topic_0000001163468626_p13201123484412"></a>可读</p> 417</th> 418<th class="cellrowborder" valign="top" width="11.51%" id="mcps1.1.6.1.4"><p id="zh-cn_topic_0000001163468626_p1320123412448"><a name="zh-cn_topic_0000001163468626_p1320123412448"></a><a name="zh-cn_topic_0000001163468626_p1320123412448"></a>可写</p> 419</th> 420<th class="cellrowborder" valign="top" width="52.42%" id="mcps1.1.6.1.5"><p id="zh-cn_topic_0000001163468626_p9201934134419"><a name="zh-cn_topic_0000001163468626_p9201934134419"></a><a name="zh-cn_topic_0000001163468626_p9201934134419"></a>说明</p> 421</th> 422</tr> 423</thead> 424<tbody><tr id="zh-cn_topic_0000001163468626_row3201103494415"><td class="cellrowborder" valign="top" width="15.870000000000001%" headers="mcps1.1.6.1.1 "><p id="zh-cn_topic_0000001163468626_p20826502499"><a name="zh-cn_topic_0000001163468626_p20826502499"></a><a name="zh-cn_topic_0000001163468626_p20826502499"></a>screenDensity</p> 425</td> 426<td class="cellrowborder" valign="top" width="10.86%" headers="mcps1.1.6.1.2 "><p id="zh-cn_topic_0000001163468626_p120143413448"><a name="zh-cn_topic_0000001163468626_p120143413448"></a><a name="zh-cn_topic_0000001163468626_p120143413448"></a><a href="#zh-cn_topic_0000001163468626_section7331173812197">ScreenDensity</a></p> 427</td> 428<td class="cellrowborder" valign="top" width="9.34%" headers="mcps1.1.6.1.3 "><p id="zh-cn_topic_0000001163468626_p18201334114417"><a name="zh-cn_topic_0000001163468626_p18201334114417"></a><a name="zh-cn_topic_0000001163468626_p18201334114417"></a>是</p> 429</td> 430<td class="cellrowborder" valign="top" width="11.51%" headers="mcps1.1.6.1.4 "><p id="zh-cn_topic_0000001163468626_p420113347441"><a name="zh-cn_topic_0000001163468626_p420113347441"></a><a name="zh-cn_topic_0000001163468626_p420113347441"></a>否</p> 431</td> 432<td class="cellrowborder" valign="top" width="52.42%" headers="mcps1.1.6.1.5 "><p id="zh-cn_topic_0000001163468626_p202021934134412"><a name="zh-cn_topic_0000001163468626_p202021934134412"></a><a name="zh-cn_topic_0000001163468626_p202021934134412"></a>当前设备屏幕密度</p> 433</td> 434</tr> 435<tr id="zh-cn_topic_0000001163468626_row19202113413445"><td class="cellrowborder" valign="top" width="15.870000000000001%" headers="mcps1.1.6.1.1 "><p id="zh-cn_topic_0000001163468626_p82028341442"><a name="zh-cn_topic_0000001163468626_p82028341442"></a><a name="zh-cn_topic_0000001163468626_p82028341442"></a>deviceType</p> 436</td> 437<td class="cellrowborder" valign="top" width="10.86%" headers="mcps1.1.6.1.2 "><p id="zh-cn_topic_0000001163468626_p62021434104413"><a name="zh-cn_topic_0000001163468626_p62021434104413"></a><a name="zh-cn_topic_0000001163468626_p62021434104413"></a><a href="#zh-cn_topic_0000001163468626_section4734636131914">DeviceType</a></p> 438</td> 439<td class="cellrowborder" valign="top" width="9.34%" headers="mcps1.1.6.1.3 "><p id="zh-cn_topic_0000001163468626_p142021134164413"><a name="zh-cn_topic_0000001163468626_p142021134164413"></a><a name="zh-cn_topic_0000001163468626_p142021134164413"></a>是</p> 440</td> 441<td class="cellrowborder" valign="top" width="11.51%" headers="mcps1.1.6.1.4 "><p id="zh-cn_topic_0000001163468626_p22021834104417"><a name="zh-cn_topic_0000001163468626_p22021834104417"></a><a name="zh-cn_topic_0000001163468626_p22021834104417"></a>否</p> 442</td> 443<td class="cellrowborder" valign="top" width="52.42%" headers="mcps1.1.6.1.5 "><p id="zh-cn_topic_0000001163468626_p112021341446"><a name="zh-cn_topic_0000001163468626_p112021341446"></a><a name="zh-cn_topic_0000001163468626_p112021341446"></a>当前设备类型</p> 444</td> 445</tr> 446</tbody> 447</table> 448 449## ResourceManager<a name="zh-cn_topic_0000001163468626_section137771134135415"></a> 450 451提供访问应用资源的能力。 452 453### getString<a name="zh-cn_topic_0000001163468626_section9779153419548"></a> 454 455getString\(resId: number, callback: AsyncCallback<string\>\): void 456 457用户获取指定资源ID对应的字符串,使用callback形式返回字符串。 458 459- 参数: 460 461 <a name="zh-cn_topic_0000001163468626_table15779123455418"></a> 462 <table><thead align="left"><tr id="zh-cn_topic_0000001163468626_row37791234125419"><th class="cellrowborder" valign="top" width="9.07%" id="mcps1.1.5.1.1"><p id="zh-cn_topic_0000001163468626_p1778018347547"><a name="zh-cn_topic_0000001163468626_p1778018347547"></a><a name="zh-cn_topic_0000001163468626_p1778018347547"></a>参数名</p> 463 </th> 464 <th class="cellrowborder" valign="top" width="20.48%" id="mcps1.1.5.1.2"><p id="zh-cn_topic_0000001163468626_p12780113475417"><a name="zh-cn_topic_0000001163468626_p12780113475417"></a><a name="zh-cn_topic_0000001163468626_p12780113475417"></a>类型</p> 465 </th> 466 <th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="zh-cn_topic_0000001163468626_p137801834145410"><a name="zh-cn_topic_0000001163468626_p137801834145410"></a><a name="zh-cn_topic_0000001163468626_p137801834145410"></a>必填</p> 467 </th> 468 <th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="zh-cn_topic_0000001163468626_p1678053465414"><a name="zh-cn_topic_0000001163468626_p1678053465414"></a><a name="zh-cn_topic_0000001163468626_p1678053465414"></a>说明</p> 469 </th> 470 </tr> 471 </thead> 472 <tbody><tr id="zh-cn_topic_0000001163468626_row478015349541"><td class="cellrowborder" valign="top" width="9.07%" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001163468626_p1978013410544"><a name="zh-cn_topic_0000001163468626_p1978013410544"></a><a name="zh-cn_topic_0000001163468626_p1978013410544"></a>resId</p> 473 </td> 474 <td class="cellrowborder" valign="top" width="20.48%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001163468626_p13780123410542"><a name="zh-cn_topic_0000001163468626_p13780123410542"></a><a name="zh-cn_topic_0000001163468626_p13780123410542"></a>number</p> 475 </td> 476 <td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001163468626_p14780334145419"><a name="zh-cn_topic_0000001163468626_p14780334145419"></a><a name="zh-cn_topic_0000001163468626_p14780334145419"></a>是</p> 477 </td> 478 <td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001163468626_p97801934185415"><a name="zh-cn_topic_0000001163468626_p97801934185415"></a><a name="zh-cn_topic_0000001163468626_p97801934185415"></a>资源ID值</p> 479 </td> 480 </tr> 481 <tr id="zh-cn_topic_0000001163468626_row5780334175417"><td class="cellrowborder" valign="top" width="9.07%" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001163468626_p1780113413548"><a name="zh-cn_topic_0000001163468626_p1780113413548"></a><a name="zh-cn_topic_0000001163468626_p1780113413548"></a>callback</p> 482 </td> 483 <td class="cellrowborder" valign="top" width="20.48%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001163468626_p5127248143016"><a name="zh-cn_topic_0000001163468626_p5127248143016"></a><a name="zh-cn_topic_0000001163468626_p5127248143016"></a>AsyncCallback<string></p> 484 </td> 485 <td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001163468626_p778003485413"><a name="zh-cn_topic_0000001163468626_p778003485413"></a><a name="zh-cn_topic_0000001163468626_p778003485413"></a>是</p> 486 </td> 487 <td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001163468626_p137801834105419"><a name="zh-cn_topic_0000001163468626_p137801834105419"></a><a name="zh-cn_topic_0000001163468626_p137801834105419"></a>异步回调,用于返回获取的字符串</p> 488 </td> 489 </tr> 490 </tbody> 491 </table> 492 493- 示例: 494 495 ``` 496 resourceManager.getResourceManager((error, mgr) => { 497 mgr.getString(0x1000000, (error, value) => { 498 if (error != null) { 499 console.log(value); 500 } else { 501 console.log(value); 502 } 503 }); 504 } 505 ``` 506 507 508### getString<a name="zh-cn_topic_0000001163468626_section159261924165411"></a> 509 510getString\(resId: number\): Promise<string\> 511 512用户获取指定资源ID对应的字符串,使用Promise形式返回字符串。 513 514- 参数: 515 516 <a name="zh-cn_topic_0000001163468626_table209261824205420"></a> 517 <table><thead align="left"><tr id="zh-cn_topic_0000001163468626_row1492722415415"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="zh-cn_topic_0000001163468626_p1692782416547"><a name="zh-cn_topic_0000001163468626_p1692782416547"></a><a name="zh-cn_topic_0000001163468626_p1692782416547"></a>参数名</p> 518 </th> 519 <th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="zh-cn_topic_0000001163468626_p189271240541"><a name="zh-cn_topic_0000001163468626_p189271240541"></a><a name="zh-cn_topic_0000001163468626_p189271240541"></a>类型</p> 520 </th> 521 <th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="zh-cn_topic_0000001163468626_p199271824205415"><a name="zh-cn_topic_0000001163468626_p199271824205415"></a><a name="zh-cn_topic_0000001163468626_p199271824205415"></a>必填</p> 522 </th> 523 <th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="zh-cn_topic_0000001163468626_p109270241547"><a name="zh-cn_topic_0000001163468626_p109270241547"></a><a name="zh-cn_topic_0000001163468626_p109270241547"></a>说明</p> 524 </th> 525 </tr> 526 </thead> 527 <tbody><tr id="zh-cn_topic_0000001163468626_row2927132413546"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001163468626_p135781232358"><a name="zh-cn_topic_0000001163468626_p135781232358"></a><a name="zh-cn_topic_0000001163468626_p135781232358"></a>resId</p> 528 </td> 529 <td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001163468626_p195781383513"><a name="zh-cn_topic_0000001163468626_p195781383513"></a><a name="zh-cn_topic_0000001163468626_p195781383513"></a>number</p> 530 </td> 531 <td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001163468626_p16578439358"><a name="zh-cn_topic_0000001163468626_p16578439358"></a><a name="zh-cn_topic_0000001163468626_p16578439358"></a>是</p> 532 </td> 533 <td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001163468626_p135783310357"><a name="zh-cn_topic_0000001163468626_p135783310357"></a><a name="zh-cn_topic_0000001163468626_p135783310357"></a>资源ID值</p> 534 </td> 535 </tr> 536 </tbody> 537 </table> 538 539- 返回值: 540 541 <a name="zh-cn_topic_0000001163468626_table1492913246542"></a> 542 <table><thead align="left"><tr id="zh-cn_topic_0000001163468626_row169291824135411"><th class="cellrowborder" valign="top" width="17.01%" id="mcps1.1.3.1.1"><p id="zh-cn_topic_0000001163468626_p15929132485415"><a name="zh-cn_topic_0000001163468626_p15929132485415"></a><a name="zh-cn_topic_0000001163468626_p15929132485415"></a>类型</p> 543 </th> 544 <th class="cellrowborder" valign="top" width="82.99%" id="mcps1.1.3.1.2"><p id="zh-cn_topic_0000001163468626_p392918245541"><a name="zh-cn_topic_0000001163468626_p392918245541"></a><a name="zh-cn_topic_0000001163468626_p392918245541"></a>说明</p> 545 </th> 546 </tr> 547 </thead> 548 <tbody><tr id="zh-cn_topic_0000001163468626_row1592992455414"><td class="cellrowborder" valign="top" width="17.01%" headers="mcps1.1.3.1.1 "><p id="zh-cn_topic_0000001163468626_p179291924135420"><a name="zh-cn_topic_0000001163468626_p179291924135420"></a><a name="zh-cn_topic_0000001163468626_p179291924135420"></a>Promise<string></p> 549 </td> 550 <td class="cellrowborder" valign="top" width="82.99%" headers="mcps1.1.3.1.2 "><p id="zh-cn_topic_0000001163468626_p17929142485416"><a name="zh-cn_topic_0000001163468626_p17929142485416"></a><a name="zh-cn_topic_0000001163468626_p17929142485416"></a>资源ID值对应的字符串</p> 551 </td> 552 </tr> 553 </tbody> 554 </table> 555 556- 示例: 557 558 ``` 559 resourceManager.getResourceManager((error, mgr) => { 560 mgr.getString(0x1000000).then(value => { 561 console.log(value); 562 }).catch(error => { 563 console.log("getstring promise " + error); 564 }); 565 } 566 ``` 567 568 569### getStringArray<a name="zh-cn_topic_0000001163468626_section4490132775420"></a> 570 571getStringArray\(resId: number, callback: AsyncCallback<Array<string\>\>\): void 572 573用户获取指定资源ID对应的字符串数组,使用callback形式返回字符串数组。 574 575- 参数: 576 577 <a name="zh-cn_topic_0000001163468626_table104901227185415"></a> 578 <table><thead align="left"><tr id="zh-cn_topic_0000001163468626_row1849042719548"><th class="cellrowborder" valign="top" width="8.110000000000001%" id="mcps1.1.5.1.1"><p id="zh-cn_topic_0000001163468626_p2491727195416"><a name="zh-cn_topic_0000001163468626_p2491727195416"></a><a name="zh-cn_topic_0000001163468626_p2491727195416"></a>参数名</p> 579 </th> 580 <th class="cellrowborder" valign="top" width="21.44%" id="mcps1.1.5.1.2"><p id="zh-cn_topic_0000001163468626_p449122775413"><a name="zh-cn_topic_0000001163468626_p449122775413"></a><a name="zh-cn_topic_0000001163468626_p449122775413"></a>类型</p> 581 </th> 582 <th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="zh-cn_topic_0000001163468626_p549117275549"><a name="zh-cn_topic_0000001163468626_p549117275549"></a><a name="zh-cn_topic_0000001163468626_p549117275549"></a>必填</p> 583 </th> 584 <th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="zh-cn_topic_0000001163468626_p4491152716543"><a name="zh-cn_topic_0000001163468626_p4491152716543"></a><a name="zh-cn_topic_0000001163468626_p4491152716543"></a>说明</p> 585 </th> 586 </tr> 587 </thead> 588 <tbody><tr id="zh-cn_topic_0000001163468626_row84911027155414"><td class="cellrowborder" valign="top" width="8.110000000000001%" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001163468626_p1738472410372"><a name="zh-cn_topic_0000001163468626_p1738472410372"></a><a name="zh-cn_topic_0000001163468626_p1738472410372"></a>resId</p> 589 </td> 590 <td class="cellrowborder" valign="top" width="21.44%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001163468626_p1438462419379"><a name="zh-cn_topic_0000001163468626_p1438462419379"></a><a name="zh-cn_topic_0000001163468626_p1438462419379"></a>number</p> 591 </td> 592 <td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001163468626_p13841524203711"><a name="zh-cn_topic_0000001163468626_p13841524203711"></a><a name="zh-cn_topic_0000001163468626_p13841524203711"></a>是</p> 593 </td> 594 <td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001163468626_p8384142493715"><a name="zh-cn_topic_0000001163468626_p8384142493715"></a><a name="zh-cn_topic_0000001163468626_p8384142493715"></a>资源ID值</p> 595 </td> 596 </tr> 597 <tr id="zh-cn_topic_0000001163468626_row4491142717542"><td class="cellrowborder" valign="top" width="8.110000000000001%" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001163468626_p11384142443715"><a name="zh-cn_topic_0000001163468626_p11384142443715"></a><a name="zh-cn_topic_0000001163468626_p11384142443715"></a>callback</p> 598 </td> 599 <td class="cellrowborder" valign="top" width="21.44%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001163468626_p1538472473719"><a name="zh-cn_topic_0000001163468626_p1538472473719"></a><a name="zh-cn_topic_0000001163468626_p1538472473719"></a>AsyncCallback<Array<string>></p> 600 </td> 601 <td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001163468626_p18384132473713"><a name="zh-cn_topic_0000001163468626_p18384132473713"></a><a name="zh-cn_topic_0000001163468626_p18384132473713"></a>是</p> 602 </td> 603 <td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001163468626_p8384132411379"><a name="zh-cn_topic_0000001163468626_p8384132411379"></a><a name="zh-cn_topic_0000001163468626_p8384132411379"></a>异步回调,用于返回获取的字符串数组</p> 604 </td> 605 </tr> 606 </tbody> 607 </table> 608 609- 示例: 610 611 ``` 612 resourceManager.getResourceManager((error, mgr) => { 613 mgr.getStringArray(0x1000000, (error, value) => { 614 if (error != null) { 615 console.log(value); 616 } else { 617 console.log(value); 618 } 619 }); 620 } 621 ``` 622 623 624### getStringArray<a name="zh-cn_topic_0000001163468626_section1992322017541"></a> 625 626getStringArray\(resId: number\): Promise<Array<string\>\> 627 628用户获取指定资源ID对应的字符串数组,使用Promise形式返回字符串数组。 629 630- 参数: 631 632 <a name="zh-cn_topic_0000001163468626_table11924132005411"></a> 633 <table><thead align="left"><tr id="zh-cn_topic_0000001163468626_row13924172017543"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="zh-cn_topic_0000001163468626_p1392442016541"><a name="zh-cn_topic_0000001163468626_p1392442016541"></a><a name="zh-cn_topic_0000001163468626_p1392442016541"></a>参数名</p> 634 </th> 635 <th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="zh-cn_topic_0000001163468626_p0924920145417"><a name="zh-cn_topic_0000001163468626_p0924920145417"></a><a name="zh-cn_topic_0000001163468626_p0924920145417"></a>类型</p> 636 </th> 637 <th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="zh-cn_topic_0000001163468626_p392452011549"><a name="zh-cn_topic_0000001163468626_p392452011549"></a><a name="zh-cn_topic_0000001163468626_p392452011549"></a>必填</p> 638 </th> 639 <th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="zh-cn_topic_0000001163468626_p1992492065414"><a name="zh-cn_topic_0000001163468626_p1992492065414"></a><a name="zh-cn_topic_0000001163468626_p1992492065414"></a>说明</p> 640 </th> 641 </tr> 642 </thead> 643 <tbody><tr id="zh-cn_topic_0000001163468626_row15924220135414"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001163468626_p1451111743917"><a name="zh-cn_topic_0000001163468626_p1451111743917"></a><a name="zh-cn_topic_0000001163468626_p1451111743917"></a>resId</p> 644 </td> 645 <td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001163468626_p9511157113911"><a name="zh-cn_topic_0000001163468626_p9511157113911"></a><a name="zh-cn_topic_0000001163468626_p9511157113911"></a>number</p> 646 </td> 647 <td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001163468626_p195117718397"><a name="zh-cn_topic_0000001163468626_p195117718397"></a><a name="zh-cn_topic_0000001163468626_p195117718397"></a>是</p> 648 </td> 649 <td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001163468626_p151119713915"><a name="zh-cn_topic_0000001163468626_p151119713915"></a><a name="zh-cn_topic_0000001163468626_p151119713915"></a>资源ID值</p> 650 </td> 651 </tr> 652 </tbody> 653 </table> 654 655- 返回值: 656 657 <a name="zh-cn_topic_0000001163468626_table1492552055418"></a> 658 <table><thead align="left"><tr id="zh-cn_topic_0000001163468626_row20925132035420"><th class="cellrowborder" valign="top" width="20.05%" id="mcps1.1.3.1.1"><p id="zh-cn_topic_0000001163468626_p10925202010544"><a name="zh-cn_topic_0000001163468626_p10925202010544"></a><a name="zh-cn_topic_0000001163468626_p10925202010544"></a>类型</p> 659 </th> 660 <th class="cellrowborder" valign="top" width="79.95%" id="mcps1.1.3.1.2"><p id="zh-cn_topic_0000001163468626_p129269201544"><a name="zh-cn_topic_0000001163468626_p129269201544"></a><a name="zh-cn_topic_0000001163468626_p129269201544"></a>说明</p> 661 </th> 662 </tr> 663 </thead> 664 <tbody><tr id="zh-cn_topic_0000001163468626_row119261820145419"><td class="cellrowborder" valign="top" width="20.05%" headers="mcps1.1.3.1.1 "><p id="zh-cn_topic_0000001163468626_p179309445393"><a name="zh-cn_topic_0000001163468626_p179309445393"></a><a name="zh-cn_topic_0000001163468626_p179309445393"></a>Promise<Array<string>></p> 665 </td> 666 <td class="cellrowborder" valign="top" width="79.95%" headers="mcps1.1.3.1.2 "><p id="zh-cn_topic_0000001163468626_p139301144153915"><a name="zh-cn_topic_0000001163468626_p139301144153915"></a><a name="zh-cn_topic_0000001163468626_p139301144153915"></a>资源ID值对应的字符串数组</p> 667 </td> 668 </tr> 669 </tbody> 670 </table> 671 672- 示例: 673 674 ``` 675 resourceManager.getResourceManager((error, mgr) => { 676 mgr.getStringArray(0x1000000).then(value => { 677 console.log(value); 678 }).catch(error => { 679 console.log("getstring promise " + error); 680 }); 681 } 682 ``` 683 684 685### getMedia<a name="zh-cn_topic_0000001163468626_section6710152513409"></a> 686 687getMedia\(resId: number, callback: AsyncCallback<Uint8Array\>\): void 688 689用户获取指定资源ID对应的媒体文件内容,使用callback形式返回字节数组。 690 691- 参数: 692 693 <a name="zh-cn_topic_0000001163468626_table13710192554016"></a> 694 <table><thead align="left"><tr id="zh-cn_topic_0000001163468626_row3710152534017"><th class="cellrowborder" valign="top" width="7.901402961808262%" id="mcps1.1.5.1.1"><p id="zh-cn_topic_0000001163468626_p47108259406"><a name="zh-cn_topic_0000001163468626_p47108259406"></a><a name="zh-cn_topic_0000001163468626_p47108259406"></a>参数名</p> 695 </th> 696 <th class="cellrowborder" valign="top" width="25.565081839438818%" id="mcps1.1.5.1.2"><p id="zh-cn_topic_0000001163468626_p2710102564013"><a name="zh-cn_topic_0000001163468626_p2710102564013"></a><a name="zh-cn_topic_0000001163468626_p2710102564013"></a>类型</p> 697 </th> 698 <th class="cellrowborder" valign="top" width="6.819953234606392%" id="mcps1.1.5.1.3"><p id="zh-cn_topic_0000001163468626_p17710525154014"><a name="zh-cn_topic_0000001163468626_p17710525154014"></a><a name="zh-cn_topic_0000001163468626_p17710525154014"></a>必填</p> 699 </th> 700 <th class="cellrowborder" valign="top" width="59.713561964146535%" id="mcps1.1.5.1.4"><p id="zh-cn_topic_0000001163468626_p771022517402"><a name="zh-cn_topic_0000001163468626_p771022517402"></a><a name="zh-cn_topic_0000001163468626_p771022517402"></a>说明</p> 701 </th> 702 </tr> 703 </thead> 704 <tbody><tr id="zh-cn_topic_0000001163468626_row871062544010"><td class="cellrowborder" valign="top" width="7.901402961808262%" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001163468626_p1871016257407"><a name="zh-cn_topic_0000001163468626_p1871016257407"></a><a name="zh-cn_topic_0000001163468626_p1871016257407"></a>resId</p> 705 </td> 706 <td class="cellrowborder" valign="top" width="25.565081839438818%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001163468626_p1371002534015"><a name="zh-cn_topic_0000001163468626_p1371002534015"></a><a name="zh-cn_topic_0000001163468626_p1371002534015"></a>number</p> 707 </td> 708 <td class="cellrowborder" valign="top" width="6.819953234606392%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001163468626_p16711122515403"><a name="zh-cn_topic_0000001163468626_p16711122515403"></a><a name="zh-cn_topic_0000001163468626_p16711122515403"></a>是</p> 709 </td> 710 <td class="cellrowborder" valign="top" width="59.713561964146535%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001163468626_p1271119257400"><a name="zh-cn_topic_0000001163468626_p1271119257400"></a><a name="zh-cn_topic_0000001163468626_p1271119257400"></a>资源ID值</p> 711 </td> 712 </tr> 713 <tr id="zh-cn_topic_0000001163468626_row1971112524019"><td class="cellrowborder" valign="top" width="7.901402961808262%" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001163468626_p27111125204017"><a name="zh-cn_topic_0000001163468626_p27111125204017"></a><a name="zh-cn_topic_0000001163468626_p27111125204017"></a>callback</p> 714 </td> 715 <td class="cellrowborder" valign="top" width="25.565081839438818%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001163468626_p1371152514409"><a name="zh-cn_topic_0000001163468626_p1371152514409"></a><a name="zh-cn_topic_0000001163468626_p1371152514409"></a>AsyncCallback<Array<Uint8Array>></p> 716 </td> 717 <td class="cellrowborder" valign="top" width="6.819953234606392%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001163468626_p13711625124019"><a name="zh-cn_topic_0000001163468626_p13711625124019"></a><a name="zh-cn_topic_0000001163468626_p13711625124019"></a>是</p> 718 </td> 719 <td class="cellrowborder" valign="top" width="59.713561964146535%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001163468626_p8711172511406"><a name="zh-cn_topic_0000001163468626_p8711172511406"></a><a name="zh-cn_topic_0000001163468626_p8711172511406"></a>异步回调,用于返回获取的媒体文件内容</p> 720 </td> 721 </tr> 722 </tbody> 723 </table> 724 725- 示例: 726 727 ``` 728 resourceManager.getResourceManager((error, mgr) => { 729 mgr.getMedia(0x1000000, (error, value) => { 730 if (error != null) { 731 console.log(value); 732 } else { 733 console.log(value); 734 } 735 }); 736 } 737 ``` 738 739 740### getMedia<a name="zh-cn_topic_0000001163468626_section6711152517409"></a> 741 742getMedia\(resId: number\): Promise<Uint8Array\> 743 744用户获取指定资源ID对应的媒体文件内容,使用Promise形式返回字节数组。 745 746- 参数: 747 748 <a name="zh-cn_topic_0000001163468626_table10711725154015"></a> 749 <table><thead align="left"><tr id="zh-cn_topic_0000001163468626_row8712225154016"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="zh-cn_topic_0000001163468626_p371210253407"><a name="zh-cn_topic_0000001163468626_p371210253407"></a><a name="zh-cn_topic_0000001163468626_p371210253407"></a>参数名</p> 750 </th> 751 <th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="zh-cn_topic_0000001163468626_p771214253404"><a name="zh-cn_topic_0000001163468626_p771214253404"></a><a name="zh-cn_topic_0000001163468626_p771214253404"></a>类型</p> 752 </th> 753 <th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="zh-cn_topic_0000001163468626_p171242574017"><a name="zh-cn_topic_0000001163468626_p171242574017"></a><a name="zh-cn_topic_0000001163468626_p171242574017"></a>必填</p> 754 </th> 755 <th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="zh-cn_topic_0000001163468626_p6712725114013"><a name="zh-cn_topic_0000001163468626_p6712725114013"></a><a name="zh-cn_topic_0000001163468626_p6712725114013"></a>说明</p> 756 </th> 757 </tr> 758 </thead> 759 <tbody><tr id="zh-cn_topic_0000001163468626_row971232544013"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001163468626_p67126252406"><a name="zh-cn_topic_0000001163468626_p67126252406"></a><a name="zh-cn_topic_0000001163468626_p67126252406"></a>resId</p> 760 </td> 761 <td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001163468626_p12712425114012"><a name="zh-cn_topic_0000001163468626_p12712425114012"></a><a name="zh-cn_topic_0000001163468626_p12712425114012"></a>number</p> 762 </td> 763 <td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001163468626_p19712152511403"><a name="zh-cn_topic_0000001163468626_p19712152511403"></a><a name="zh-cn_topic_0000001163468626_p19712152511403"></a>是</p> 764 </td> 765 <td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001163468626_p8712162564019"><a name="zh-cn_topic_0000001163468626_p8712162564019"></a><a name="zh-cn_topic_0000001163468626_p8712162564019"></a>资源ID值</p> 766 </td> 767 </tr> 768 </tbody> 769 </table> 770 771- 返回值: 772 773 <a name="zh-cn_topic_0000001163468626_table271292534018"></a> 774 <table><thead align="left"><tr id="zh-cn_topic_0000001163468626_row1971352524020"><th class="cellrowborder" valign="top" width="23.02%" id="mcps1.1.3.1.1"><p id="zh-cn_topic_0000001163468626_p9713925104011"><a name="zh-cn_topic_0000001163468626_p9713925104011"></a><a name="zh-cn_topic_0000001163468626_p9713925104011"></a>类型</p> 775 </th> 776 <th class="cellrowborder" valign="top" width="76.98%" id="mcps1.1.3.1.2"><p id="zh-cn_topic_0000001163468626_p471352574010"><a name="zh-cn_topic_0000001163468626_p471352574010"></a><a name="zh-cn_topic_0000001163468626_p471352574010"></a>说明</p> 777 </th> 778 </tr> 779 </thead> 780 <tbody><tr id="zh-cn_topic_0000001163468626_row9713142554012"><td class="cellrowborder" valign="top" width="23.02%" headers="mcps1.1.3.1.1 "><p id="zh-cn_topic_0000001163468626_p1071352554019"><a name="zh-cn_topic_0000001163468626_p1071352554019"></a><a name="zh-cn_topic_0000001163468626_p1071352554019"></a>Promise<Array<Uint8Array>></p> 781 </td> 782 <td class="cellrowborder" valign="top" width="76.98%" headers="mcps1.1.3.1.2 "><p id="zh-cn_topic_0000001163468626_p8713192517405"><a name="zh-cn_topic_0000001163468626_p8713192517405"></a><a name="zh-cn_topic_0000001163468626_p8713192517405"></a>资源ID值对应的媒体文件内容</p> 783 </td> 784 </tr> 785 </tbody> 786 </table> 787 788- 示例: 789 790 ``` 791 resourceManager.getResourceManager((error, mgr) => { 792 mgr.getMedia(0x1000000).then(value => { 793 console.log(value); 794 }).catch(error => { 795 console.log("getstring promise " + error); 796 }); 797 } 798 ``` 799 800 801### getMediaBase64<a name="zh-cn_topic_0000001163468626_section11402326194315"></a> 802 803getMediaBase64\(resId: number, callback: AsyncCallback<string\>\): void 804 805用户获取指定资源ID对应的图片资源Base64编码,使用callback形式返回字符串。 806 807- 参数: 808 809 <a name="zh-cn_topic_0000001163468626_table1740272614430"></a> 810 <table><thead align="left"><tr id="zh-cn_topic_0000001163468626_row540272684311"><th class="cellrowborder" valign="top" width="7.901402961808262%" id="mcps1.1.5.1.1"><p id="zh-cn_topic_0000001163468626_p1340272624311"><a name="zh-cn_topic_0000001163468626_p1340272624311"></a><a name="zh-cn_topic_0000001163468626_p1340272624311"></a>参数名</p> 811 </th> 812 <th class="cellrowborder" valign="top" width="25.565081839438818%" id="mcps1.1.5.1.2"><p id="zh-cn_topic_0000001163468626_p8402192617438"><a name="zh-cn_topic_0000001163468626_p8402192617438"></a><a name="zh-cn_topic_0000001163468626_p8402192617438"></a>类型</p> 813 </th> 814 <th class="cellrowborder" valign="top" width="6.819953234606392%" id="mcps1.1.5.1.3"><p id="zh-cn_topic_0000001163468626_p1440222674312"><a name="zh-cn_topic_0000001163468626_p1440222674312"></a><a name="zh-cn_topic_0000001163468626_p1440222674312"></a>必填</p> 815 </th> 816 <th class="cellrowborder" valign="top" width="59.713561964146535%" id="mcps1.1.5.1.4"><p id="zh-cn_topic_0000001163468626_p11403926164312"><a name="zh-cn_topic_0000001163468626_p11403926164312"></a><a name="zh-cn_topic_0000001163468626_p11403926164312"></a>说明</p> 817 </th> 818 </tr> 819 </thead> 820 <tbody><tr id="zh-cn_topic_0000001163468626_row54031726114310"><td class="cellrowborder" valign="top" width="7.901402961808262%" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001163468626_p114031326154312"><a name="zh-cn_topic_0000001163468626_p114031326154312"></a><a name="zh-cn_topic_0000001163468626_p114031326154312"></a>resId</p> 821 </td> 822 <td class="cellrowborder" valign="top" width="25.565081839438818%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001163468626_p1040382604313"><a name="zh-cn_topic_0000001163468626_p1040382604313"></a><a name="zh-cn_topic_0000001163468626_p1040382604313"></a>number</p> 823 </td> 824 <td class="cellrowborder" valign="top" width="6.819953234606392%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001163468626_p94035265431"><a name="zh-cn_topic_0000001163468626_p94035265431"></a><a name="zh-cn_topic_0000001163468626_p94035265431"></a>是</p> 825 </td> 826 <td class="cellrowborder" valign="top" width="59.713561964146535%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001163468626_p1140392612434"><a name="zh-cn_topic_0000001163468626_p1140392612434"></a><a name="zh-cn_topic_0000001163468626_p1140392612434"></a>资源ID值</p> 827 </td> 828 </tr> 829 <tr id="zh-cn_topic_0000001163468626_row12403192615432"><td class="cellrowborder" valign="top" width="7.901402961808262%" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001163468626_p14031226144319"><a name="zh-cn_topic_0000001163468626_p14031226144319"></a><a name="zh-cn_topic_0000001163468626_p14031226144319"></a>callback</p> 830 </td> 831 <td class="cellrowborder" valign="top" width="25.565081839438818%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001163468626_p1740382618433"><a name="zh-cn_topic_0000001163468626_p1740382618433"></a><a name="zh-cn_topic_0000001163468626_p1740382618433"></a>AsyncCallback<string></p> 832 </td> 833 <td class="cellrowborder" valign="top" width="6.819953234606392%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001163468626_p144032026104313"><a name="zh-cn_topic_0000001163468626_p144032026104313"></a><a name="zh-cn_topic_0000001163468626_p144032026104313"></a>是</p> 834 </td> 835 <td class="cellrowborder" valign="top" width="59.713561964146535%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001163468626_p18403142618437"><a name="zh-cn_topic_0000001163468626_p18403142618437"></a><a name="zh-cn_topic_0000001163468626_p18403142618437"></a>异步回调,用于返回获取的图片资源Base64编码</p> 836 </td> 837 </tr> 838 </tbody> 839 </table> 840 841- 示例: 842 843 ``` 844 resourceManager.getResourceManager((error, mgr) => { 845 mgr.getMediaBase64(0x1000000, (error, value) => { 846 if (error != null) { 847 console.log(value); 848 } else { 849 console.log(value); 850 } 851 }); 852 } 853 ``` 854 855 856### getMediaBase64<a name="zh-cn_topic_0000001163468626_section6404726124312"></a> 857 858getMediaBase64\(resId: number\): Promise<string\> 859 860用户获取指定资源ID对应的图片资源Base64编码,使用Promise形式返回字符串。 861 862- 参数: 863 864 <a name="zh-cn_topic_0000001163468626_table1840452674318"></a> 865 <table><thead align="left"><tr id="zh-cn_topic_0000001163468626_row84041226184317"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="zh-cn_topic_0000001163468626_p5404926154316"><a name="zh-cn_topic_0000001163468626_p5404926154316"></a><a name="zh-cn_topic_0000001163468626_p5404926154316"></a>参数名</p> 866 </th> 867 <th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="zh-cn_topic_0000001163468626_p194048268435"><a name="zh-cn_topic_0000001163468626_p194048268435"></a><a name="zh-cn_topic_0000001163468626_p194048268435"></a>类型</p> 868 </th> 869 <th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="zh-cn_topic_0000001163468626_p184041226104320"><a name="zh-cn_topic_0000001163468626_p184041226104320"></a><a name="zh-cn_topic_0000001163468626_p184041226104320"></a>必填</p> 870 </th> 871 <th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="zh-cn_topic_0000001163468626_p12404726184315"><a name="zh-cn_topic_0000001163468626_p12404726184315"></a><a name="zh-cn_topic_0000001163468626_p12404726184315"></a>说明</p> 872 </th> 873 </tr> 874 </thead> 875 <tbody><tr id="zh-cn_topic_0000001163468626_row8404126124314"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001163468626_p104051426104313"><a name="zh-cn_topic_0000001163468626_p104051426104313"></a><a name="zh-cn_topic_0000001163468626_p104051426104313"></a>resId</p> 876 </td> 877 <td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001163468626_p15405172610430"><a name="zh-cn_topic_0000001163468626_p15405172610430"></a><a name="zh-cn_topic_0000001163468626_p15405172610430"></a>number</p> 878 </td> 879 <td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001163468626_p240582616430"><a name="zh-cn_topic_0000001163468626_p240582616430"></a><a name="zh-cn_topic_0000001163468626_p240582616430"></a>是</p> 880 </td> 881 <td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001163468626_p124051726104318"><a name="zh-cn_topic_0000001163468626_p124051726104318"></a><a name="zh-cn_topic_0000001163468626_p124051726104318"></a>资源ID值</p> 882 </td> 883 </tr> 884 </tbody> 885 </table> 886 887- 返回值: 888 889 <a name="zh-cn_topic_0000001163468626_table1240514269437"></a> 890 <table><thead align="left"><tr id="zh-cn_topic_0000001163468626_row1240532620433"><th class="cellrowborder" valign="top" width="23.02%" id="mcps1.1.3.1.1"><p id="zh-cn_topic_0000001163468626_p1406202614313"><a name="zh-cn_topic_0000001163468626_p1406202614313"></a><a name="zh-cn_topic_0000001163468626_p1406202614313"></a>类型</p> 891 </th> 892 <th class="cellrowborder" valign="top" width="76.98%" id="mcps1.1.3.1.2"><p id="zh-cn_topic_0000001163468626_p8406226124316"><a name="zh-cn_topic_0000001163468626_p8406226124316"></a><a name="zh-cn_topic_0000001163468626_p8406226124316"></a>说明</p> 893 </th> 894 </tr> 895 </thead> 896 <tbody><tr id="zh-cn_topic_0000001163468626_row164065261435"><td class="cellrowborder" valign="top" width="23.02%" headers="mcps1.1.3.1.1 "><p id="zh-cn_topic_0000001163468626_p5406182612436"><a name="zh-cn_topic_0000001163468626_p5406182612436"></a><a name="zh-cn_topic_0000001163468626_p5406182612436"></a>Promise<string></p> 897 </td> 898 <td class="cellrowborder" valign="top" width="76.98%" headers="mcps1.1.3.1.2 "><p id="zh-cn_topic_0000001163468626_p3406182612434"><a name="zh-cn_topic_0000001163468626_p3406182612434"></a><a name="zh-cn_topic_0000001163468626_p3406182612434"></a>资源ID值对应的图片资源Base64编码</p> 899 </td> 900 </tr> 901 </tbody> 902 </table> 903 904- 示例: 905 906 ``` 907 resourceManager.getResourceManager((error, mgr) => { 908 mgr.getMediaBase64(0x1000000).then(value => { 909 console.log(value); 910 }).catch(error => { 911 console.log("getstring promise " + error); 912 }); 913 } 914 ``` 915 916 917### getConfiguration<a name="zh-cn_topic_0000001163468626_section8123152874015"></a> 918 919getConfiguration\(callback: AsyncCallback<Configuration\>\): void 920 921用户获取设备的Configuration,使用callback形式返回Configuration对象。 922 923- 参数: 924 925 <a name="zh-cn_topic_0000001163468626_table15123112811401"></a> 926 <table><thead align="left"><tr id="zh-cn_topic_0000001163468626_row13123102844013"><th class="cellrowborder" valign="top" width="8.110000000000001%" id="mcps1.1.5.1.1"><p id="zh-cn_topic_0000001163468626_p1812311285406"><a name="zh-cn_topic_0000001163468626_p1812311285406"></a><a name="zh-cn_topic_0000001163468626_p1812311285406"></a>参数名</p> 927 </th> 928 <th class="cellrowborder" valign="top" width="21.44%" id="mcps1.1.5.1.2"><p id="zh-cn_topic_0000001163468626_p101239284409"><a name="zh-cn_topic_0000001163468626_p101239284409"></a><a name="zh-cn_topic_0000001163468626_p101239284409"></a>类型</p> 929 </th> 930 <th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="zh-cn_topic_0000001163468626_p41236289403"><a name="zh-cn_topic_0000001163468626_p41236289403"></a><a name="zh-cn_topic_0000001163468626_p41236289403"></a>必填</p> 931 </th> 932 <th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="zh-cn_topic_0000001163468626_p201231228164019"><a name="zh-cn_topic_0000001163468626_p201231228164019"></a><a name="zh-cn_topic_0000001163468626_p201231228164019"></a>说明</p> 933 </th> 934 </tr> 935 </thead> 936 <tbody><tr id="zh-cn_topic_0000001163468626_row141241285400"><td class="cellrowborder" valign="top" width="8.110000000000001%" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001163468626_p812452814012"><a name="zh-cn_topic_0000001163468626_p812452814012"></a><a name="zh-cn_topic_0000001163468626_p812452814012"></a>callback</p> 937 </td> 938 <td class="cellrowborder" valign="top" width="21.44%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001163468626_p1412420284405"><a name="zh-cn_topic_0000001163468626_p1412420284405"></a><a name="zh-cn_topic_0000001163468626_p1412420284405"></a>AsyncCallback<<a href="#zh-cn_topic_0000001163468626_section12882825611">Configuration</a>></p> 939 </td> 940 <td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001163468626_p10124122817403"><a name="zh-cn_topic_0000001163468626_p10124122817403"></a><a name="zh-cn_topic_0000001163468626_p10124122817403"></a>是</p> 941 </td> 942 <td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001163468626_p161241028184011"><a name="zh-cn_topic_0000001163468626_p161241028184011"></a><a name="zh-cn_topic_0000001163468626_p161241028184011"></a>异步回调,用于返回设备的Configuration</p> 943 </td> 944 </tr> 945 </tbody> 946 </table> 947 948- 示例: 949 950 ``` 951 resourceManager.getResourceManager((error, mgr) => { 952 mgr.getConfiguration((error, value) => { 953 if (error != null) { 954 console.log(value); 955 } else { 956 console.log(value); 957 } 958 }); 959 } 960 ``` 961 962 963### getConfiguration<a name="zh-cn_topic_0000001163468626_section312515284406"></a> 964 965getConfiguration\(\): Promise<Configuration\> 966 967用户获取设备的Configuration,使用Promise形式返回Configuration对象。 968 969- 返回值: 970 971 <a name="zh-cn_topic_0000001163468626_table12126228134013"></a> 972 <table><thead align="left"><tr id="zh-cn_topic_0000001163468626_row11126728184016"><th class="cellrowborder" valign="top" width="20.05%" id="mcps1.1.3.1.1"><p id="zh-cn_topic_0000001163468626_p191261028174019"><a name="zh-cn_topic_0000001163468626_p191261028174019"></a><a name="zh-cn_topic_0000001163468626_p191261028174019"></a>类型</p> 973 </th> 974 <th class="cellrowborder" valign="top" width="79.95%" id="mcps1.1.3.1.2"><p id="zh-cn_topic_0000001163468626_p6126202894018"><a name="zh-cn_topic_0000001163468626_p6126202894018"></a><a name="zh-cn_topic_0000001163468626_p6126202894018"></a>说明</p> 975 </th> 976 </tr> 977 </thead> 978 <tbody><tr id="zh-cn_topic_0000001163468626_row8126728174017"><td class="cellrowborder" valign="top" width="20.05%" headers="mcps1.1.3.1.1 "><p id="zh-cn_topic_0000001163468626_p112718283409"><a name="zh-cn_topic_0000001163468626_p112718283409"></a><a name="zh-cn_topic_0000001163468626_p112718283409"></a>Promise<<a href="#zh-cn_topic_0000001163468626_section12882825611">Configuration</a>></p> 979 </td> 980 <td class="cellrowborder" valign="top" width="79.95%" headers="mcps1.1.3.1.2 "><p id="zh-cn_topic_0000001163468626_p1412792864011"><a name="zh-cn_topic_0000001163468626_p1412792864011"></a><a name="zh-cn_topic_0000001163468626_p1412792864011"></a>设备的Configuration</p> 981 </td> 982 </tr> 983 </tbody> 984 </table> 985 986- 示例: 987 988 ``` 989 resourceManager.getResourceManager((error, mgr) => { 990 mgr.getConfiguration().then(value => { 991 console.log(value); 992 }).catch(error => { 993 console.log("getstring promise " + error); 994 }); 995 } 996 ``` 997 998 999### getDeviceCapability<a name="zh-cn_topic_0000001163468626_section104951210135017"></a> 1000 1001getDeviceCapability\(callback: AsyncCallback<DeviceCapability\>\): void 1002 1003用户获取设备的DeviceCapability,使用callback形式返回DeviceCapability对象。 1004 1005- 参数: 1006 1007 <a name="zh-cn_topic_0000001163468626_table1495410115014"></a> 1008 <table><thead align="left"><tr id="zh-cn_topic_0000001163468626_row649514108507"><th class="cellrowborder" valign="top" width="8.7%" id="mcps1.1.5.1.1"><p id="zh-cn_topic_0000001163468626_p54957102501"><a name="zh-cn_topic_0000001163468626_p54957102501"></a><a name="zh-cn_topic_0000001163468626_p54957102501"></a>参数名</p> 1009 </th> 1010 <th class="cellrowborder" valign="top" width="24.69%" id="mcps1.1.5.1.2"><p id="zh-cn_topic_0000001163468626_p649531011504"><a name="zh-cn_topic_0000001163468626_p649531011504"></a><a name="zh-cn_topic_0000001163468626_p649531011504"></a>类型</p> 1011 </th> 1012 <th class="cellrowborder" valign="top" width="5.319999999999999%" id="mcps1.1.5.1.3"><p id="zh-cn_topic_0000001163468626_p74954109501"><a name="zh-cn_topic_0000001163468626_p74954109501"></a><a name="zh-cn_topic_0000001163468626_p74954109501"></a>必填</p> 1013 </th> 1014 <th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="zh-cn_topic_0000001163468626_p174951910155019"><a name="zh-cn_topic_0000001163468626_p174951910155019"></a><a name="zh-cn_topic_0000001163468626_p174951910155019"></a>说明</p> 1015 </th> 1016 </tr> 1017 </thead> 1018 <tbody><tr id="zh-cn_topic_0000001163468626_row11495710115015"><td class="cellrowborder" valign="top" width="8.7%" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001163468626_p154951510185014"><a name="zh-cn_topic_0000001163468626_p154951510185014"></a><a name="zh-cn_topic_0000001163468626_p154951510185014"></a>callback</p> 1019 </td> 1020 <td class="cellrowborder" valign="top" width="24.69%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001163468626_p174955105509"><a name="zh-cn_topic_0000001163468626_p174955105509"></a><a name="zh-cn_topic_0000001163468626_p174955105509"></a>AsyncCallback<<a href="#zh-cn_topic_0000001163468626_section7200123494410">DeviceCapability</a>></p> 1021 </td> 1022 <td class="cellrowborder" valign="top" width="5.319999999999999%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001163468626_p1495121012501"><a name="zh-cn_topic_0000001163468626_p1495121012501"></a><a name="zh-cn_topic_0000001163468626_p1495121012501"></a>是</p> 1023 </td> 1024 <td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001163468626_p54969103507"><a name="zh-cn_topic_0000001163468626_p54969103507"></a><a name="zh-cn_topic_0000001163468626_p54969103507"></a>异步回调,用于返回设备的DeviceCapability</p> 1025 </td> 1026 </tr> 1027 </tbody> 1028 </table> 1029 1030- 示例: 1031 1032 ``` 1033 resourceManager.getResourceManager((error, mgr) => { 1034 mgr.getDeviceCapability((error, value) => { 1035 if (error != null) { 1036 console.log(value); 1037 } else { 1038 console.log(value); 1039 } 1040 }); 1041 } 1042 ``` 1043 1044 1045### getDeviceCapability<a name="zh-cn_topic_0000001163468626_section114961410115013"></a> 1046 1047getDeviceCapability\(\): Promise<DeviceCapability\> 1048 1049用户获取设备的DeviceCapability,使用Promise形式返回DeviceCapability对象。 1050 1051- 返回值: 1052 1053 <a name="zh-cn_topic_0000001163468626_table17496111015019"></a> 1054 <table><thead align="left"><tr id="zh-cn_topic_0000001163468626_row12496111095010"><th class="cellrowborder" valign="top" width="20.05%" id="mcps1.1.3.1.1"><p id="zh-cn_topic_0000001163468626_p1496101015503"><a name="zh-cn_topic_0000001163468626_p1496101015503"></a><a name="zh-cn_topic_0000001163468626_p1496101015503"></a>类型</p> 1055 </th> 1056 <th class="cellrowborder" valign="top" width="79.95%" id="mcps1.1.3.1.2"><p id="zh-cn_topic_0000001163468626_p1496110155013"><a name="zh-cn_topic_0000001163468626_p1496110155013"></a><a name="zh-cn_topic_0000001163468626_p1496110155013"></a>说明</p> 1057 </th> 1058 </tr> 1059 </thead> 1060 <tbody><tr id="zh-cn_topic_0000001163468626_row10496181065014"><td class="cellrowborder" valign="top" width="20.05%" headers="mcps1.1.3.1.1 "><p id="zh-cn_topic_0000001163468626_p19497151095012"><a name="zh-cn_topic_0000001163468626_p19497151095012"></a><a name="zh-cn_topic_0000001163468626_p19497151095012"></a>Promise<<a href="#zh-cn_topic_0000001163468626_section7200123494410">DeviceCapability</a>></p> 1061 </td> 1062 <td class="cellrowborder" valign="top" width="79.95%" headers="mcps1.1.3.1.2 "><p id="zh-cn_topic_0000001163468626_p18497141011504"><a name="zh-cn_topic_0000001163468626_p18497141011504"></a><a name="zh-cn_topic_0000001163468626_p18497141011504"></a>设备的DeviceCapability</p> 1063 </td> 1064 </tr> 1065 </tbody> 1066 </table> 1067 1068- 示例: 1069 1070 ``` 1071 resourceManager.getResourceManager((error, mgr) => { 1072 mgr.getDeviceCapability().then(value => { 1073 console.log(value); 1074 }).catch(error => { 1075 console.log("getstring promise " + error); 1076 }); 1077 } 1078 ``` 1079 1080 1081### getPluralString<a name="zh-cn_topic_0000001163468626_section1549163064013"></a> 1082 1083getPluralString\(resId: number, num: number, callback: AsyncCallback<string\>\): void 1084 1085根据指定数量获取指定ID字符串表示的单复数字符串,使用callback形式返回字符串。 1086 1087- 参数: 1088 1089 <a name="zh-cn_topic_0000001163468626_table649330164020"></a> 1090 <table><thead align="left"><tr id="zh-cn_topic_0000001163468626_row6491302400"><th class="cellrowborder" valign="top" width="8.110000000000001%" id="mcps1.1.5.1.1"><p id="zh-cn_topic_0000001163468626_p1749123034017"><a name="zh-cn_topic_0000001163468626_p1749123034017"></a><a name="zh-cn_topic_0000001163468626_p1749123034017"></a>参数名</p> 1091 </th> 1092 <th class="cellrowborder" valign="top" width="21.44%" id="mcps1.1.5.1.2"><p id="zh-cn_topic_0000001163468626_p449143064012"><a name="zh-cn_topic_0000001163468626_p449143064012"></a><a name="zh-cn_topic_0000001163468626_p449143064012"></a>类型</p> 1093 </th> 1094 <th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="zh-cn_topic_0000001163468626_p1349123044017"><a name="zh-cn_topic_0000001163468626_p1349123044017"></a><a name="zh-cn_topic_0000001163468626_p1349123044017"></a>必填</p> 1095 </th> 1096 <th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="zh-cn_topic_0000001163468626_p11491302408"><a name="zh-cn_topic_0000001163468626_p11491302408"></a><a name="zh-cn_topic_0000001163468626_p11491302408"></a>说明</p> 1097 </th> 1098 </tr> 1099 </thead> 1100 <tbody><tr id="zh-cn_topic_0000001163468626_row145013054010"><td class="cellrowborder" valign="top" width="8.110000000000001%" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001163468626_p65073012401"><a name="zh-cn_topic_0000001163468626_p65073012401"></a><a name="zh-cn_topic_0000001163468626_p65073012401"></a>resId</p> 1101 </td> 1102 <td class="cellrowborder" valign="top" width="21.44%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001163468626_p11502030124016"><a name="zh-cn_topic_0000001163468626_p11502030124016"></a><a name="zh-cn_topic_0000001163468626_p11502030124016"></a>number</p> 1103 </td> 1104 <td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001163468626_p1650330174019"><a name="zh-cn_topic_0000001163468626_p1650330174019"></a><a name="zh-cn_topic_0000001163468626_p1650330174019"></a>是</p> 1105 </td> 1106 <td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001163468626_p1650163034013"><a name="zh-cn_topic_0000001163468626_p1650163034013"></a><a name="zh-cn_topic_0000001163468626_p1650163034013"></a>资源ID值</p> 1107 </td> 1108 </tr> 1109 <tr id="zh-cn_topic_0000001163468626_row18497201611531"><td class="cellrowborder" valign="top" width="8.110000000000001%" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001163468626_p1949711615318"><a name="zh-cn_topic_0000001163468626_p1949711615318"></a><a name="zh-cn_topic_0000001163468626_p1949711615318"></a>num</p> 1110 </td> 1111 <td class="cellrowborder" valign="top" width="21.44%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001163468626_p13497191615532"><a name="zh-cn_topic_0000001163468626_p13497191615532"></a><a name="zh-cn_topic_0000001163468626_p13497191615532"></a>number</p> 1112 </td> 1113 <td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001163468626_p9497716125311"><a name="zh-cn_topic_0000001163468626_p9497716125311"></a><a name="zh-cn_topic_0000001163468626_p9497716125311"></a>是</p> 1114 </td> 1115 <td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001163468626_p249771619536"><a name="zh-cn_topic_0000001163468626_p249771619536"></a><a name="zh-cn_topic_0000001163468626_p249771619536"></a>数量值</p> 1116 </td> 1117 </tr> 1118 <tr id="zh-cn_topic_0000001163468626_row45053011403"><td class="cellrowborder" valign="top" width="8.110000000000001%" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001163468626_p1650230204016"><a name="zh-cn_topic_0000001163468626_p1650230204016"></a><a name="zh-cn_topic_0000001163468626_p1650230204016"></a>callback</p> 1119 </td> 1120 <td class="cellrowborder" valign="top" width="21.44%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001163468626_p165010302401"><a name="zh-cn_topic_0000001163468626_p165010302401"></a><a name="zh-cn_topic_0000001163468626_p165010302401"></a>AsyncCallback<string></p> 1121 </td> 1122 <td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001163468626_p7501530164018"><a name="zh-cn_topic_0000001163468626_p7501530164018"></a><a name="zh-cn_topic_0000001163468626_p7501530164018"></a>是</p> 1123 </td> 1124 <td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001163468626_p17501330104012"><a name="zh-cn_topic_0000001163468626_p17501330104012"></a><a name="zh-cn_topic_0000001163468626_p17501330104012"></a>异步回调,返回根据指定数量获取指定ID字符串表示的单复数字符串</p> 1125 </td> 1126 </tr> 1127 </tbody> 1128 </table> 1129 1130- 示例: 1131 1132 ``` 1133 resourceManager.getResourceManager((error, mgr) => { 1134 mgr.getPluralString(0x1000000, 1, (error, value) => { 1135 if (error != null) { 1136 console.log(value); 1137 } else { 1138 console.log(value); 1139 } 1140 }); 1141 } 1142 ``` 1143 1144 1145### getPluralString<a name="zh-cn_topic_0000001163468626_section165183015405"></a> 1146 1147getPluralString\(resId: number, num: number\): Promise<string\> 1148 1149根据指定数量获取对指定ID字符串表示的单复数字符串,使用Promise形式返回字符串。 1150 1151- 参数: 1152 1153 <a name="zh-cn_topic_0000001163468626_table105173016408"></a> 1154 <table><thead align="left"><tr id="zh-cn_topic_0000001163468626_row195223064018"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="zh-cn_topic_0000001163468626_p1752183064013"><a name="zh-cn_topic_0000001163468626_p1752183064013"></a><a name="zh-cn_topic_0000001163468626_p1752183064013"></a>参数名</p> 1155 </th> 1156 <th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="zh-cn_topic_0000001163468626_p175273064016"><a name="zh-cn_topic_0000001163468626_p175273064016"></a><a name="zh-cn_topic_0000001163468626_p175273064016"></a>类型</p> 1157 </th> 1158 <th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="zh-cn_topic_0000001163468626_p1452430124014"><a name="zh-cn_topic_0000001163468626_p1452430124014"></a><a name="zh-cn_topic_0000001163468626_p1452430124014"></a>必填</p> 1159 </th> 1160 <th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="zh-cn_topic_0000001163468626_p9525305406"><a name="zh-cn_topic_0000001163468626_p9525305406"></a><a name="zh-cn_topic_0000001163468626_p9525305406"></a>说明</p> 1161 </th> 1162 </tr> 1163 </thead> 1164 <tbody><tr id="zh-cn_topic_0000001163468626_row65233019409"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001163468626_p125213301405"><a name="zh-cn_topic_0000001163468626_p125213301405"></a><a name="zh-cn_topic_0000001163468626_p125213301405"></a>resId</p> 1165 </td> 1166 <td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001163468626_p55293019409"><a name="zh-cn_topic_0000001163468626_p55293019409"></a><a name="zh-cn_topic_0000001163468626_p55293019409"></a>number</p> 1167 </td> 1168 <td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001163468626_p553103094019"><a name="zh-cn_topic_0000001163468626_p553103094019"></a><a name="zh-cn_topic_0000001163468626_p553103094019"></a>是</p> 1169 </td> 1170 <td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001163468626_p1453430124015"><a name="zh-cn_topic_0000001163468626_p1453430124015"></a><a name="zh-cn_topic_0000001163468626_p1453430124015"></a>资源ID值</p> 1171 </td> 1172 </tr> 1173 <tr id="zh-cn_topic_0000001163468626_row05323013406"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001163468626_p197652617548"><a name="zh-cn_topic_0000001163468626_p197652617548"></a><a name="zh-cn_topic_0000001163468626_p197652617548"></a>num</p> 1174 </td> 1175 <td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001163468626_p187651685411"><a name="zh-cn_topic_0000001163468626_p187651685411"></a><a name="zh-cn_topic_0000001163468626_p187651685411"></a>number</p> 1176 </td> 1177 <td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001163468626_p776517611543"><a name="zh-cn_topic_0000001163468626_p776517611543"></a><a name="zh-cn_topic_0000001163468626_p776517611543"></a>是</p> 1178 </td> 1179 <td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001163468626_p2076646145413"><a name="zh-cn_topic_0000001163468626_p2076646145413"></a><a name="zh-cn_topic_0000001163468626_p2076646145413"></a>数量值</p> 1180 </td> 1181 </tr> 1182 </tbody> 1183 </table> 1184 1185- 返回值: 1186 1187 <a name="zh-cn_topic_0000001163468626_table45313011403"></a> 1188 <table><thead align="left"><tr id="zh-cn_topic_0000001163468626_row554133016401"><th class="cellrowborder" valign="top" width="20.05%" id="mcps1.1.3.1.1"><p id="zh-cn_topic_0000001163468626_p13549300401"><a name="zh-cn_topic_0000001163468626_p13549300401"></a><a name="zh-cn_topic_0000001163468626_p13549300401"></a>类型</p> 1189 </th> 1190 <th class="cellrowborder" valign="top" width="79.95%" id="mcps1.1.3.1.2"><p id="zh-cn_topic_0000001163468626_p75419307408"><a name="zh-cn_topic_0000001163468626_p75419307408"></a><a name="zh-cn_topic_0000001163468626_p75419307408"></a>说明</p> 1191 </th> 1192 </tr> 1193 </thead> 1194 <tbody><tr id="zh-cn_topic_0000001163468626_row1554143094015"><td class="cellrowborder" valign="top" width="20.05%" headers="mcps1.1.3.1.1 "><p id="zh-cn_topic_0000001163468626_p115483064019"><a name="zh-cn_topic_0000001163468626_p115483064019"></a><a name="zh-cn_topic_0000001163468626_p115483064019"></a>Promise<string></p> 1195 </td> 1196 <td class="cellrowborder" valign="top" width="79.95%" headers="mcps1.1.3.1.2 "><p id="zh-cn_topic_0000001163468626_p1965948111118"><a name="zh-cn_topic_0000001163468626_p1965948111118"></a><a name="zh-cn_topic_0000001163468626_p1965948111118"></a>根据提供的数量获取对应ID字符串表示的单复数字符串</p> 1197 </td> 1198 </tr> 1199 </tbody> 1200 </table> 1201 1202- 示例: 1203 1204 ``` 1205 resourceManager.getResourceManager((error, mgr) => { 1206 mgr.getPluralString(0x1000000, 1).then(value => { 1207 console.log(value); 1208 }).catch(error => { 1209 console.log("getstring promise " + error); 1210 }); 1211 } 1212 ``` 1213 1214 1215