1# @ohos.telephony.radio (Network Search) 2 3The **radio** module provides basic network search management functions. You can obtain the radio access technology (RAT) used in the CS and PS domains, network status, current network selection mode, ISO country code of the registered network, ID of the slot in which the primary card is located, list of signal strengths of the registered network, carrier name, and IMEI, MEID, and unique device ID of the SIM card in the specified slot. Besides, you can check whether the current device supports 5G\(NR\) and whether the radio service is enabled on the primary SIM card. 4 5>**NOTE** 6> 7>The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. 8 9 10## Modules to Import 11 12```ts 13import radio from '@ohos.telephony.radio'; 14``` 15 16## radio.getRadioTech 17 18getRadioTech\(slotId: number, callback: AsyncCallback<\{psRadioTech: RadioTechnology, csRadioTech: RadioTechnology\}\>\): void 19 20Obtains the RAT used in the CS and PS domains for the SIM card in the specified slot. This API uses an asynchronous callback to return the result. 21 22**Required permission**: ohos.permission.GET_NETWORK_INFO 23 24**System capability**: SystemCapability.Telephony.CoreService 25 26**Parameters** 27 28| Name | Type | Mandatory| Description | 29| -------- | ------------------------------------------------------------ | ---- | -------------------------------------- | 30| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 31| callback | AsyncCallback\<{psRadioTech: [RadioTechnology](#radiotechnology), csRadioTech:[RadioTechnology](#radiotechnology)}\> | Yes | Callback used to return the result. | 32 33**Error codes** 34 35For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 36 37| ID| Error Message | 38| -------- | -------------------------------------------- | 39| 201 | Permission denied. | 40| 401 | Parameter error. | 41| 8300001 | Invalid parameter value. | 42| 8300002 | Operation failed. Cannot connect to service. | 43| 8300003 | System internal error. | 44| 8300999 | Unknown error code. | 45 46**Example** 47 48```ts 49import { BusinessError } from '@ohos.base'; 50 51let slotId: number = 0; 52class Tech { 53 psRadioTech: radio.RadioTechnology = radio.RadioTechnology.RADIO_TECHNOLOGY_UNKNOWN; 54 csRadioTech: radio.RadioTechnology = radio.RadioTechnology.RADIO_TECHNOLOGY_UNKNOWN; 55} 56radio.getRadioTech(slotId, (err: BusinessError, data: Tech) => { 57 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 58}); 59``` 60 61 62## radio.getRadioTech 63 64getRadioTech\(slotId: number\): Promise<\{psRadioTech: RadioTechnology, csRadioTech: RadioTechnology\}\> 65 66Obtains the RAT used in the CS and PS domains for the SIM card in the specified slot. This API uses a promise to return the result. 67 68**Required permission**: ohos.permission.GET_NETWORK_INFO 69 70**System capability**: SystemCapability.Telephony.CoreService 71 72**Parameters** 73 74| Name| Type | Mandatory| Description | 75| ------ | ------ | ---- | -------------------------------------- | 76| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 77 78**Return value** 79 80| Type | Description | 81| ------------------------------------------------------------ | ----------------------------------------------- | 82| Promise<{psRadioTech: [RadioTechnology](#radiotechnology), csRadioTech: [RadioTechnology](#radiotechnology)}> | Promise used to return the result.| 83 84**Error codes** 85 86For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 87 88| ID| Error Message | 89| -------- | -------------------------------------------- | 90| 201 | Permission denied. | 91| 401 | Parameter error. | 92| 8300001 | Invalid parameter value. | 93| 8300002 | Operation failed. Cannot connect to service. | 94| 8300003 | System internal error. | 95| 8300999 | Unknown error code. | 96 97**Example** 98 99```ts 100import { BusinessError } from '@ohos.base'; 101 102let slotId: number = 0; 103class Tech { 104 psRadioTech: radio.RadioTechnology = radio.RadioTechnology.RADIO_TECHNOLOGY_UNKNOWN; 105 csRadioTech: radio.RadioTechnology = radio.RadioTechnology.RADIO_TECHNOLOGY_UNKNOWN; 106} 107radio.getRadioTech(slotId).then((data: Tech) => { 108 console.log(`getRadioTech success, data->${JSON.stringify(data)}`); 109}).catch((err: BusinessError) => { 110 console.log(`getRadioTech failed, err->${JSON.stringify(err)}`); 111}); 112``` 113 114 115## radio.getNetworkState 116 117getNetworkState\(callback: AsyncCallback\<NetworkState\>\): void 118 119Obtains the network status. This API uses an asynchronous callback to return the result. 120 121**Required permission**: ohos.permission.GET_NETWORK_INFO 122 123**System capability**: SystemCapability.Telephony.CoreService 124 125**Parameters** 126 127| Name | Type | Mandatory| Description | 128| -------- | ---------------------------------------------- | ---- | ---------- | 129| callback | AsyncCallback\<[NetworkState](#networkstate)\> | Yes | Callback used to return the result.| 130 131**Error codes** 132 133For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 134 135| ID| Error Message | 136| -------- | -------------------------------------------- | 137| 201 | Permission denied. | 138| 401 | Parameter error. | 139| 8300001 | Invalid parameter value. | 140| 8300002 | Operation failed. Cannot connect to service. | 141| 8300003 | System internal error. | 142| 8300999 | Unknown error code. | 143 144**Example** 145 146```ts 147import { BusinessError } from '@ohos.base'; 148 149radio.getNetworkState((err: BusinessError, data: radio.NetworkState) => { 150 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 151}); 152``` 153 154 155## radio.getNetworkState 156 157getNetworkState\(slotId: number, callback: AsyncCallback\<NetworkState\>\): void 158 159Obtains the network status of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. 160 161**Required permission**: ohos.permission.GET_NETWORK_INFO 162 163**System capability**: SystemCapability.Telephony.CoreService 164 165**Parameters** 166 167| Name | Type | Mandatory| Description | 168| -------- | ---------------------------------------------- | ---- | -------------------------------------- | 169| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 170| callback | AsyncCallback\<[NetworkState](#networkstate)\> | Yes | Callback used to return the result. | 171 172**Error codes** 173 174For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 175 176| ID| Error Message | 177| -------- | -------------------------------------------- | 178| 201 | Permission denied. | 179| 401 | Parameter error. | 180| 8300001 | Invalid parameter value. | 181| 8300002 | Operation failed. Cannot connect to service. | 182| 8300003 | System internal error. | 183| 8300999 | Unknown error code. | 184 185**Example** 186 187```ts 188import { BusinessError } from '@ohos.base'; 189 190let slotId: number = 0; 191radio.getNetworkState(slotId, (err: BusinessError, data: radio.NetworkState) => { 192 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 193}); 194``` 195 196 197## radio.getNetworkState 198 199getNetworkState\(slotId?: number\): Promise\<NetworkState\> 200 201Obtains the network status of the SIM card in the specified slot. This API uses a promise to return the result. 202 203**Required permission**: ohos.permission.GET_NETWORK_INFO 204 205**System capability**: SystemCapability.Telephony.CoreService 206 207**Parameters** 208 209| Name| Type | Mandatory| Description | 210| ------ | ------ | ---- | -------------------------------------- | 211| slotId | number | No | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 212 213**Return value** 214 215| Type | Description | 216| ---------------------------------------- | --------------------------- | 217| Promise\<[NetworkState](#networkstate)\> | Promise used to return the result.| 218 219**Error codes** 220 221For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 222 223| ID| Error Message | 224| -------- | -------------------------------------------- | 225| 201 | Permission denied. | 226| 401 | Parameter error. | 227| 8300001 | Invalid parameter value. | 228| 8300002 | Operation failed. Cannot connect to service. | 229| 8300003 | System internal error. | 230| 8300999 | Unknown error code. | 231 232**Example** 233 234```ts 235import { BusinessError } from '@ohos.base'; 236 237let slotId: number = 0; 238radio.getNetworkState(slotId).then((data: radio.NetworkState) => { 239 console.log(`getNetworkState success, promise: data->${JSON.stringify(data)}`); 240}).catch((err: BusinessError) => { 241 console.log(`getNetworkState failed, promise: err->${JSON.stringify(err)}`); 242}); 243``` 244 245 246## radio.getNetworkSelectionMode 247 248getNetworkSelectionMode\(slotId: number, callback: AsyncCallback\<NetworkSelectionMode\>\): void 249 250Obtains the network selection mode of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. 251 252**System capability**: SystemCapability.Telephony.CoreService 253 254**Parameters** 255 256| Name | Type | Mandatory| Description | 257| -------- | ------------------------------------------------------------ | ---- | -------------------------------------- | 258| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 259| callback | AsyncCallback\<[NetworkSelectionMode](#networkselectionmode)\> | Yes | Callback used to return the result. | 260 261**Error codes** 262 263For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 264 265| ID| Error Message | 266| -------- | -------------------------------------------- | 267| 401 | Parameter error. | 268| 8300001 | Invalid parameter value. | 269| 8300002 | Operation failed. Cannot connect to service. | 270| 8300003 | System internal error. | 271| 8300999 | Unknown error code. | 272 273**Example** 274 275```ts 276import { BusinessError } from '@ohos.base'; 277 278let slotId: number = 0; 279radio.getNetworkSelectionMode(slotId, (err: BusinessError, data: radio.NetworkSelectionMode) => { 280 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 281}); 282``` 283 284 285## radio.getNetworkSelectionMode 286 287getNetworkSelectionMode\(slotId: number\): Promise\<NetworkSelectionMode\> 288 289Obtains the network selection mode of the SIM card in the specified slot. This API uses a promise to return the result. 290 291**System capability**: SystemCapability.Telephony.CoreService 292 293**Parameters** 294 295| Name| Type | Mandatory| Description | 296| ------ | ------ | ---- | -------------------------------------- | 297| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 298 299**Return value** 300 301| Type | Description | 302| -------------------------------------------------------- | ------------------------------- | 303| Promise\<[NetworkSelectionMode](#networkselectionmode)\> | Promise used to return the result.| 304 305**Error codes** 306 307For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 308 309| ID| Error Message | 310| -------- | -------------------------------------------- | 311| 401 | Parameter error. | 312| 8300001 | Invalid parameter value. | 313| 8300002 | Operation failed. Cannot connect to service. | 314| 8300003 | System internal error. | 315| 8300999 | Unknown error code. | 316 317**Example** 318 319```ts 320import { BusinessError } from '@ohos.base'; 321 322let slotId: number = 0; 323radio.getNetworkSelectionMode(slotId).then((data: radio.NetworkSelectionMode) => { 324 console.log(`getNetworkSelectionMode success, promise: data->${JSON.stringify(data)}`); 325}).catch((err: BusinessError) => { 326 console.log(`getNetworkSelectionMode failed, promise: err->${JSON.stringify(err)}`); 327}); 328``` 329 330 331## radio.getISOCountryCodeForNetwork<sup>7+</sup> 332 333getISOCountryCodeForNetwork\(slotId: number, callback: AsyncCallback\<string\>\): void 334 335Obtains the ISO country code of the network with which the SIM card in the specified slot is registered. This API uses an asynchronous callback to return the result. 336 337**System capability**: SystemCapability.Telephony.CoreService 338 339**Parameters** 340 341| Name | Type | Mandatory| Description | 342| -------- | ----------------------- | ---- | ---------------------------------------- | 343| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 | 344| callback | AsyncCallback\<string\> | Yes | Callback used to return the result, which is an ISO country code, for example, **CN** (China).| 345 346**Error codes** 347 348For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 349 350| ID| Error Message | 351| -------- | -------------------------------------------- | 352| 401 | Parameter error. | 353| 8300001 | Invalid parameter value. | 354| 8300002 | Operation failed. Cannot connect to service. | 355| 8300003 | System internal error. | 356| 8300999 | Unknown error code. | 357 358**Example** 359 360```ts 361import { BusinessError } from '@ohos.base'; 362 363let slotId: number = 0; 364radio.getISOCountryCodeForNetwork(slotId, (err: BusinessError, data: string) => { 365 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 366}); 367``` 368 369 370## radio.getISOCountryCodeForNetwork<sup>7+</sup> 371 372getISOCountryCodeForNetwork\(slotId: number\): Promise\<string\> 373 374Obtains the ISO country code of the network with which the SIM card in the specified slot is registered. This API uses a promise to return the result. 375 376**System capability**: SystemCapability.Telephony.CoreService 377 378**Parameters** 379 380| Name| Type | Mandatory| Description | 381| ------ | ------ | ---- | -------------------------------------- | 382| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 383 384**Return value** 385 386| Type | Description | 387| ----------------- | ------------------------------------------------------------ | 388| Promise\<string\> | Promise used to return the result, which is an ISO country code, for example, **CN** (China).| 389 390**Error codes** 391 392For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 393 394| ID| Error Message | 395| -------- | -------------------------------------------- | 396| 401 | Parameter error. | 397| 8300001 | Invalid parameter value. | 398| 8300002 | Operation failed. Cannot connect to service. | 399| 8300003 | System internal error. | 400| 8300999 | Unknown error code. | 401 402**Example** 403 404```ts 405import { BusinessError } from '@ohos.base'; 406 407let slotId: number = 0; 408radio.getISOCountryCodeForNetwork(slotId).then((data: string) => { 409 console.log(`getISOCountryCodeForNetwork success, promise: data->${JSON.stringify(data)}`); 410}).catch((err: BusinessError) => { 411 console.log(`getISOCountryCodeForNetwork failed, promise: err->${JSON.stringify(err)}`); 412}); 413``` 414 415## radio.getISOCountryCodeForNetworkSync<sup>10+</sup> 416 417getISOCountryCodeForNetworkSync\(slotId: number\): string 418 419Obtains the ISO country code of the network with which the SIM card in the specified slot is registered. 420 421**System capability**: SystemCapability.Telephony.CoreService 422 423**Parameters** 424 425| Name| Type | Mandatory| Description | 426| ------ | ------ | ---- | -------------------------------------- | 427| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 428 429**Return value** 430 431| Type | Description | 432| ----------------- | ------------------------------------------------------------ | 433| string | ISO country code of the network, for example, **CN** (China).| 434 435**Example** 436 437```js 438let slotId = 0; 439let countryISO = radio.getISOCountryCodeForNetworkSync(slotId); 440console.log(`the country ISO is:` + countryISO); 441``` 442 443 444 445## radio.getPrimarySlotId<sup>7+</sup> 446 447getPrimarySlotId\(callback: AsyncCallback\<number\>\): void 448 449Obtains the ID of the slot in which the primary card is located. This API uses an asynchronous callback to return the result. 450 451**System capability**: SystemCapability.Telephony.CoreService 452 453**Parameters** 454 455| Name | Type | Mandatory| Description | 456| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | 457| callback | AsyncCallback\<number\> | Yes | Callback used to return the result.| 458 459**Error codes** 460 461For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 462 463| ID| Error Message | 464| -------- | -------------------------------------------- | 465| 8300001 | Invalid parameter value. | 466| 8300002 | Operation failed. Cannot connect to service. | 467| 8300003 | System internal error. | 468| 8300999 | Unknown error code. | 469 470**Example** 471 472```ts 473import { BusinessError } from '@ohos.base'; 474 475radio.getPrimarySlotId((err: BusinessError, data: number) => { 476 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 477}); 478``` 479 480 481## radio.getPrimarySlotId<sup>7+</sup> 482 483getPrimarySlotId\(\): Promise\<number\> 484 485Obtains the ID of the slot in which the primary card is located. This API uses a promise to return the result. 486 487**System capability**: SystemCapability.Telephony.CoreService 488 489**Return value** 490 491| Type | Description | 492| ----------------------------------------------------------- | ------------------------------------------------------------ | 493| Promise\<number\> | Promise used to return the result.| 494 495**Error codes** 496 497For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 498 499| ID| Error Message | 500| -------- | -------------------------------------------- | 501| 8300002 | Operation failed. Cannot connect to service. | 502| 8300003 | System internal error. | 503| 8300999 | Unknown error code. | 504 505**Example** 506 507```ts 508import { BusinessError } from '@ohos.base'; 509 510radio.getPrimarySlotId().then((data: number) => { 511 console.log(`getPrimarySlotId success, promise: data->${JSON.stringify(data)}`); 512}).catch((err: BusinessError) => { 513 console.error(`getPrimarySlotId failed, promise: err->${JSON.stringify(err)}`); 514}); 515``` 516 517 518## radio.getSignalInformation<sup>7+</sup> 519 520getSignalInformation\(slotId: number, callback: AsyncCallback\<Array\<SignalInformation\>\>\): void 521 522Obtains a list of signal strengths of the network with which the SIM card in the specified slot is registered. This API uses an asynchronous callback to return the result. 523 524**System capability**: SystemCapability.Telephony.CoreService 525 526**Parameters** 527 528| Name | Type | Mandatory| Description | 529| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | 530| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 | 531| callback | AsyncCallback\<Array\<[SignalInformation](#signalinformation)\>\> | Yes | Callback used to return the result, which is a list of [SignalInformation](#signalinformation) objects.| 532 533**Error codes** 534 535For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 536 537| ID| Error Message | 538| -------- | -------------------------------------------- | 539| 401 | Parameter error. | 540| 8300001 | Invalid parameter value. | 541| 8300002 | Operation failed. Cannot connect to service. | 542| 8300003 | System internal error. | 543| 8300999 | Unknown error code. | 544 545**Example** 546 547```ts 548import { BusinessError } from '@ohos.base'; 549 550let slotId: number = 0; 551radio.getSignalInformation(slotId, (err: BusinessError, data: Array<radio.SignalInformation>) => { 552 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 553}); 554``` 555 556 557## radio.getSignalInformation<sup>7+</sup> 558 559getSignalInformation\(slotId: number\): Promise\<Array\<SignalInformation\>\> 560 561Obtains a list of signal strengths of the network with which the SIM card in the specified slot is registered. This API uses a promise to return the result. 562 563**System capability**: SystemCapability.Telephony.CoreService 564 565**Parameters** 566 567| Name| Type | Mandatory| Description | 568| ------ | ------ | ---- | -------------------------------------- | 569| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 570 571**Return value** 572 573| Type | Description | 574| ----------------------------------------------------------- | ------------------------------------------------------------ | 575| Promise\<Array\<[SignalInformation](#signalinformation)\>\> | Promise used to return the result, which is a list of [SignalInformation](#signalinformation) objects.| 576 577**Error codes** 578 579For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 580 581| ID| Error Message | 582| -------- | -------------------------------------------- | 583| 401 | Parameter error. | 584| 8300001 | Invalid parameter value. | 585| 8300002 | Operation failed. Cannot connect to service. | 586| 8300003 | System internal error. | 587| 8300999 | Unknown error code. | 588 589**Example** 590 591```ts 592import { BusinessError } from '@ohos.base'; 593 594let slotId: number = 0; 595radio.getSignalInformation(slotId).then((data: Array<radio.SignalInformation>) => { 596 console.log(`getSignalInformation success, promise: data->${JSON.stringify(data)}`); 597}).catch((err: BusinessError) => { 598 console.error(`getSignalInformation failed, promise: err->${JSON.stringify(err)}`); 599}); 600``` 601 602## radio.getSignalInformationSync<sup>10+</sup> 603 604getSignalInformationSync\(slotId: number\): Array\<SignalInformation\> 605 606Obtains a list of signal strengths of the network with which the SIM card in the specified slot is registered. 607 608**System capability**: SystemCapability.Telephony.CoreService 609 610**Parameters** 611 612| Name| Type | Mandatory| Description | 613| ------ | ------ | ---- | -------------------------------------- | 614| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 615 616**Return value** 617 618| Type | Description | 619| ----------------------------------------------------------- | ------------------------------------------------------------ | 620| Array\<[SignalInformation](#signalinformation)\>| Array of [SignalInformation](#signalinformation) objects.| 621 622 623**Example** 624 625```js 626let slotId = 0; 627let signalInfo = radio.getSignalInformationSync(slotId); 628console.log(`signal information size is:` + signalInfo.length); 629``` 630 631## radio.isNrSupported<sup>(deprecated)</sup> 632 633isNrSupported\(\): boolean 634 635Checks whether the SIM card supports 5G \(NR\). 636 637> **NOTE** 638> 639> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [isNRSupported](#radioisnrsupported9). 640 641**System capability**: SystemCapability.Telephony.CoreService 642 643**Return value** 644 645| Type | Description | 646| ------- | -------------------------------- | 647| boolean | - **true**: The current device supports 5G \(NR\).<br>- **false**: The current device does not support 5G \(NR\).| 648 649**Example** 650 651```ts 652let result: boolean = radio.isNrSupported(); 653console.log("Result: "+ result); 654``` 655 656## radio.isNrSupported<sup>(deprecated)</sup> 657 658isNrSupported\(slotId: number\): boolean 659 660Checks whether the SIM card in the specified slot supports 5G \(NR\). 661 662> **NOTE** 663> 664> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [isNRSupported](#radioisnrsupported9-1). 665 666**System capability**: SystemCapability.Telephony.CoreService 667 668**Parameters** 669 670| Name| Type | Mandatory| Description | 671| ------ | ------ | ---- | -------------------------------------- | 672| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 673 674**Return value** 675 676| Type | Description | 677| ------------------ | ------------------------------------------------------------ | 678| boolean | - **true**: The current device supports 5G \(NR\).<br>- **false**: The current device does not support 5G \(NR\).| 679 680**Example** 681 682```ts 683let slotId: number = 0; 684let result: boolean = radio.isNrSupported(slotId); 685console.log("Result: "+ result); 686``` 687 688 689## radio.isNRSupported<sup>9+</sup> 690 691isNRSupported\(\): boolean 692 693Checks whether the current device supports 5G \(NR\). 694 695**System capability**: SystemCapability.Telephony.CoreService 696 697**Return value** 698 699| Type | Description | 700| ------- | -------------------------------- | 701| boolean | - **true**: The current device supports 5G \(NR\).<br>- **false**: The current device does not support 5G \(NR\).| 702 703**Example** 704 705```ts 706let result: boolean = radio.isNRSupported(); 707console.log("Result: "+ result); 708``` 709 710 711## radio.isNRSupported<sup>9+</sup> 712 713isNRSupported\(slotId: number\): boolean 714 715Checks whether the current device supports 5G \(NR\). 716 717**System capability**: SystemCapability.Telephony.CoreService 718 719**Parameters** 720 721| Name| Type | Mandatory| Description | 722| ------ | ------ | ---- | -------------------------------------- | 723| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 724 725**Return value** 726 727| Type | Description | 728| ------------------ | ------------------------------------------------------------ | 729| boolean | - **true**: The current device supports 5G \(NR\).<br>- **false**: The current device does not support 5G \(NR\).| 730 731**Example** 732 733```ts 734let slotId: number = 0; 735let result: boolean = radio.isNRSupported(slotId); 736console.log("Result: "+ result); 737``` 738 739 740## radio.isRadioOn<sup>7+</sup> 741 742isRadioOn\(callback: AsyncCallback\<boolean\>\): void 743 744Checks whether the radio service is enabled on the primary SIM card. This API uses an asynchronous callback to return the result. 745 746**Required permission**: ohos.permission.GET_NETWORK_INFO 747 748**System capability**: SystemCapability.Telephony.CoreService 749 750**Parameters** 751 752| Name | Type | Mandatory| Description | 753| -------- | ------------------------ | ---- | ------------------------------------------------------- | 754| callback | AsyncCallback\<boolean\> | Yes | Callback used to return the result.<br>- **true**: The radio service is enabled.<br>- **false**: The radio service is disabled.| 755 756**Error codes** 757 758For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 759 760| ID| Error Message | 761| -------- | -------------------------------------------- | 762| 201 | Permission denied. | 763| 401 | Parameter error. | 764| 8300001 | Invalid parameter value. | 765| 8300002 | Operation failed. Cannot connect to service. | 766| 8300003 | System internal error. | 767| 8300999 | Unknown error code. | 768 769**Example** 770 771```ts 772import { BusinessError } from '@ohos.base'; 773 774radio.isRadioOn((err: BusinessError, data: boolean) => { 775 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 776}); 777``` 778 779 780## radio.isRadioOn<sup>7+</sup> 781 782isRadioOn\(slotId: number, callback: AsyncCallback\<boolean\>\): void 783 784Checks whether the radio service is enabled on the SIM card in the specified slot. This API uses an asynchronous callback to return the result. 785 786**Required permission**: ohos.permission.GET_NETWORK_INFO 787 788**System capability**: SystemCapability.Telephony.CoreService 789 790**Parameters** 791 792| Name | Type | Mandatory| Description | 793| -------- | ------------------------ | ---- | ------------------------------------------------------- | 794| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 | 795| callback | AsyncCallback\<boolean\> | Yes | Callback used to return the result.<br>- **true**: The radio service is enabled.<br>- **false**: The radio service is disabled.| 796 797**Error codes** 798 799For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 800 801| ID| Error Message | 802| -------- | -------------------------------------------- | 803| 201 | Permission denied. | 804| 401 | Parameter error. | 805| 8300001 | Invalid parameter value. | 806| 8300002 | Operation failed. Cannot connect to service. | 807| 8300003 | System internal error. | 808| 8300999 | Unknown error code. | 809 810**Example** 811 812```ts 813import { BusinessError } from '@ohos.base'; 814 815let slotId: number = 0; 816radio.isRadioOn(slotId, (err: BusinessError, data: boolean) => { 817 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 818}); 819``` 820 821 822## radio.isRadioOn<sup>7+</sup> 823 824isRadioOn\(slotId?: number\): Promise\<boolean\> 825 826Checks whether the radio service is enabled on the SIM card in the specified slot. This API uses a promise to return the result. 827 828**Required permission**: ohos.permission.GET_NETWORK_INFO 829 830**System capability**: SystemCapability.Telephony.CoreService 831 832**Parameters** 833 834| Name| Type | Mandatory| Description | 835| ------ | ------ | ---- | -------------------------------------- | 836| slotId | number | No | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2<br>If the slot ID is not specified, this API is defaulted to check whether the radio service is enabled on the primary SIM card.| 837 838**Return value** 839 840| Type | Description | 841| ------------------ | ------------------------------------------------------------ | 842| Promise\<boolean\> | Promise used to return the result.<br>- **true**: The radio service is enabled.<br>- **false**: The radio service is disabled.| 843 844**Error codes** 845 846For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 847 848| ID| Error Message | 849| -------- | -------------------------------------------- | 850| 201 | Permission denied. | 851| 401 | Parameter error. | 852| 8300001 | Invalid parameter value. | 853| 8300002 | Operation failed. Cannot connect to service. | 854| 8300003 | System internal error. | 855| 8300999 | Unknown error code. | 856 857**Example** 858 859```ts 860import { BusinessError } from '@ohos.base'; 861 862let slotId: number = 0; 863radio.isRadioOn(slotId).then((data: boolean) => { 864 console.log(`isRadioOn success, promise: data->${JSON.stringify(data)}`); 865}).catch((err: BusinessError) => { 866 console.error(`isRadioOn failed, promise: err->${JSON.stringify(err)}`); 867}); 868``` 869 870 871## radio.getOperatorName<sup>7+</sup> 872 873getOperatorName\(slotId: number, callback: AsyncCallback\<string\>\): void 874 875Obtains the carrier name of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. 876 877**System capability**: SystemCapability.Telephony.CoreService 878 879**Parameters** 880 881| Name | Type | Mandatory| Description | 882| -------- | ----------------------- | ---- | ------------------------------------------ | 883| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 | 884| callback | AsyncCallback\<string\> | Yes | Callback used to return the result, which is the carrier name, for example, China Mobile.| 885 886**Error codes** 887 888For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 889 890| ID| Error Message | 891| -------- | -------------------------------------------- | 892| 401 | Parameter error. | 893| 8300001 | Invalid parameter value. | 894| 8300002 | Operation failed. Cannot connect to service. | 895| 8300003 | System internal error. | 896| 8300999 | Unknown error code. | 897 898**Example** 899 900```ts 901import { BusinessError } from '@ohos.base'; 902 903let slotId: number = 0; 904radio.getOperatorName(slotId, (err: BusinessError, data: string) => { 905 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 906}); 907``` 908 909 910## radio.getOperatorName<sup>7+</sup> 911 912getOperatorName\(slotId: number\): Promise\<string\> 913 914Obtains the carrier name of the SIM card in the specified slot. This API uses a promise to return the result. 915 916**System capability**: SystemCapability.Telephony.CoreService 917 918**Parameters** 919 920| Name| Type | Mandatory| Description | 921| ------ | ------ | ---- | -------------------------------------- | 922| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 923 924**Return value** 925 926| Type | Description | 927| ----------------- | ------------------------------------------------------------ | 928| Promise\<string\> | Promise used t return the result, which is the carrier name, for example, China Mobile. | 929 930**Error codes** 931 932For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 933 934| ID| Error Message | 935| -------- | -------------------------------------------- | 936| 401 | Parameter error. | 937| 8300001 | Invalid parameter value. | 938| 8300002 | Operation failed. Cannot connect to service. | 939| 8300003 | System internal error. | 940| 8300999 | Unknown error code. | 941 942**Example** 943 944```ts 945import { BusinessError } from '@ohos.base'; 946 947let slotId: number = 0; 948radio.getOperatorName(slotId).then((data: string) => { 949 console.log(`getOperatorName success, promise: data->${JSON.stringify(data)}`); 950}).catch((err: BusinessError) => { 951 console.log(`getOperatorName failed, promise: err->${JSON.stringify(err)}`); 952}); 953``` 954 955## radio.getOperatorNameSync<sup>10+</sup> 956 957getOperatorNameSync\(slotId: number\): string 958 959Obtains the carrier name of the SIM card in the specified slot. 960 961**System capability**: SystemCapability.Telephony.CoreService 962 963**Parameters** 964 965| Name| Type | Mandatory| Description | 966| ------ | ------ | ---- | -------------------------------------- | 967| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 968 969**Return value** 970 971| Type | Description | 972| ----------------- | ------------------------------------------------------------ | 973| string | Carrier name, for example, China Mobile. | 974 975 976**Example** 977 978```js 979let slotId = 0; 980let operatorName = radio.getOperatorNameSync(slotId); 981console.log(`operator name is:` + operatorName); 982``` 983 984## radio.setPrimarySlotId<sup>8+</sup> 985 986setPrimarySlotId\(slotId: number, callback: AsyncCallback\<void\>\): void 987 988Sets the ID of the slot in which the primary card is located. This API uses an asynchronous callback to return the result. 989 990**System API**: This is a system API. 991 992**Required permission**: ohos.permission.SET_TELEPHONY_STATE 993 994**System capability**: SystemCapability.Telephony.CoreService 995 996**Parameters** 997 998| Name | Type | Mandatory| Description | 999| -------- | --------------------- | ---- | -------------------------------------- | 1000| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 1001| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. | 1002 1003**Error codes** 1004 1005For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 1006 1007| ID| Error Message | 1008| -------- | -------------------------------------------- | 1009| 201 | Permission denied. | 1010| 202 | Non-system applications use system APIs. | 1011| 401 | Parameter error. | 1012| 8300001 | Invalid parameter value. | 1013| 8300002 | Operation failed. Cannot connect to service. | 1014| 8300003 | System internal error. | 1015| 8300004 | Do not have sim card. | 1016| 8300999 | Unknown error code. | 1017 1018**Example** 1019 1020```ts 1021import { BusinessError } from '@ohos.base'; 1022 1023let slotId: number = 0; 1024radio.setPrimarySlotId(slotId, (err: BusinessError) => { 1025 console.log(`callback: err->${JSON.stringify(err)}`); 1026}); 1027``` 1028 1029 1030## radio.setPrimarySlotId<sup>8+</sup> 1031 1032setPrimarySlotId\(slotId: number\): Promise\<void\> 1033 1034Sets the ID of the slot in which the primary card is located. This API uses a promise to return the result. 1035 1036**System API**: This is a system API. 1037 1038**Required permission**: ohos.permission.SET_TELEPHONY_STATE 1039 1040**System capability**: SystemCapability.Telephony.CoreService 1041 1042**Parameters** 1043 1044| Name| Type | Mandatory| Description | 1045| ------ | ------ | ---- | -------------------------------------- | 1046| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 1047 1048**Return value** 1049 1050| Type | Description | 1051| --------------- | ------------------------------- | 1052| Promise\<void\> | Promise used to return the result.| 1053 1054**Error codes** 1055 1056For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 1057 1058| ID| Error Message | 1059| -------- | -------------------------------------------- | 1060| 201 | Permission denied. | 1061| 202 | Non-system applications use system APIs. | 1062| 401 | Parameter error. | 1063| 8300001 | Invalid parameter value. | 1064| 8300002 | Operation failed. Cannot connect to service. | 1065| 8300003 | System internal error. | 1066| 8300004 | Do not have sim card. | 1067| 8300999 | Unknown error code. | 1068 1069**Example** 1070 1071```ts 1072import { BusinessError } from '@ohos.base'; 1073 1074let slotId: number = 0; 1075radio.setPrimarySlotId(slotId).then(() => { 1076 console.log(`setPrimarySlotId success.`); 1077}).catch((err: BusinessError) => { 1078 console.log(`setPrimarySlotId failed, promise: err->${JSON.stringify(err)}`); 1079}); 1080``` 1081 1082## radio.getIMEI<sup>8+</sup> 1083 1084getIMEI\(callback: AsyncCallback\<string\>\): void 1085 1086Obtains the IMEI of the SIM card. This API uses an asynchronous callback to return the result. 1087 1088**System API**: This is a system API. 1089 1090**Required permission**: ohos.permission.GET_TELEPHONY_STATE 1091 1092**System capability**: SystemCapability.Telephony.CoreService 1093 1094**Parameters** 1095 1096| Name | Type | Mandatory| Description | 1097| -------- | ----------------------- | ---- | ------------------------------------------ | 1098| callback | AsyncCallback\<string\> | Yes | Callback used to return the result. If the IMEI does not exist, an empty string is returned.| 1099 1100**Error codes** 1101 1102For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 1103 1104| ID| Error Message | 1105| -------- | -------------------------------------------- | 1106| 201 | Permission denied. | 1107| 202 | Non-system applications use system APIs. | 1108| 401 | Parameter error. | 1109| 8300001 | Invalid parameter value. | 1110| 8300002 | Operation failed. Cannot connect to service. | 1111| 8300003 | System internal error. | 1112| 8300999 | Unknown error code. | 1113 1114**Example** 1115 1116```ts 1117import { BusinessError } from '@ohos.base'; 1118 1119radio.getIMEI((err: BusinessError, data: string) => { 1120 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 1121}); 1122``` 1123 1124 1125## radio.getIMEI<sup>8+</sup> 1126 1127getIMEI\(slotId: number, callback: AsyncCallback\<string\>\): void 1128 1129Obtains the IMEI of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. 1130 1131**System API**: This is a system API. 1132 1133**Required permission**: ohos.permission.GET_TELEPHONY_STATE 1134 1135**System capability**: SystemCapability.Telephony.CoreService 1136 1137**Parameters** 1138 1139| Name | Type | Mandatory| Description | 1140| -------- | ----------------------- | ---- | ------------------------------------------ | 1141| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 | 1142| callback | AsyncCallback\<string\> | Yes | Callback used to return the result. If the IMEI does not exist, an empty string is returned.| 1143 1144**Error codes** 1145 1146For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 1147 1148| ID| Error Message | 1149| -------- | -------------------------------------------- | 1150| 201 | Permission denied. | 1151| 202 | Non-system applications use system APIs. | 1152| 401 | Parameter error. | 1153| 8300001 | Invalid parameter value. | 1154| 8300002 | Operation failed. Cannot connect to service. | 1155| 8300003 | System internal error. | 1156| 8300999 | Unknown error code. | 1157 1158**Example** 1159 1160```ts 1161import { BusinessError } from '@ohos.base'; 1162 1163let slotId: number = 0; 1164radio.getIMEI(slotId, (err: BusinessError, data: string) => { 1165 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 1166}); 1167``` 1168 1169 1170## radio.getIMEI<sup>8+</sup> 1171 1172getIMEI\(slotId?: number\): Promise\<string\> 1173 1174Obtains the IMEI of the SIM card in the specified slot. This API uses a promise to return the result. 1175 1176**System API**: This is a system API. 1177 1178**Required permission**: ohos.permission.GET_TELEPHONY_STATE 1179 1180**System capability**: SystemCapability.Telephony.CoreService 1181 1182**Parameters** 1183 1184| Name| Type | Mandatory| Description | 1185| ------ | ------ | ---- | -------------------------------------- | 1186| slotId | number | No | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 1187 1188**Return value** 1189 1190| Type | Description | 1191| ----------------- | ------------------------------------------ | 1192| Promise\<string\> | Promise used to return the result. If the IMEI does not exist, an empty string is returned.| 1193 1194**Error codes** 1195 1196For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 1197 1198| ID| Error Message | 1199| -------- | -------------------------------------------- | 1200| 201 | Permission denied. | 1201| 202 | Non-system applications use system APIs. | 1202| 401 | Parameter error. | 1203| 8300001 | Invalid parameter value. | 1204| 8300002 | Operation failed. Cannot connect to service. | 1205| 8300003 | System internal error. | 1206| 8300999 | Unknown error code. | 1207 1208**Example** 1209 1210```ts 1211import { BusinessError } from '@ohos.base'; 1212 1213let slotId: number = 0; 1214radio.getIMEI(slotId).then((data: string) => { 1215 console.log(`getIMEI success, promise: data->${JSON.stringify(data)}`); 1216}).catch((err: BusinessError) => { 1217 console.error(`getIMEI failed, promise: err->${JSON.stringify(err)}`); 1218}); 1219``` 1220 1221## radio.getMEID<sup>8+</sup> 1222 1223getMEID\(callback: AsyncCallback\<string\>\): void 1224 1225Obtains the MEID of the SIM card. This API uses an asynchronous callback to return the result. 1226 1227**System API**: This is a system API. 1228 1229**Required permission**: ohos.permission.GET_TELEPHONY_STATE 1230 1231**System capability**: SystemCapability.Telephony.CoreService 1232 1233**Parameters** 1234 1235| Name | Type | Mandatory| Description | 1236| -------- | ----------------------- | ---- | ---------- | 1237| callback | AsyncCallback\<string\> | Yes | Callback used to return the result.| 1238 1239**Error codes** 1240 1241For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 1242 1243| ID| Error Message | 1244| -------- | -------------------------------------------- | 1245| 201 | Permission denied. | 1246| 202 | Non-system applications use system APIs. | 1247| 401 | Parameter error. | 1248| 8300001 | Invalid parameter value. | 1249| 8300002 | Operation failed. Cannot connect to service. | 1250| 8300003 | System internal error. | 1251| 8300999 | Unknown error code. | 1252 1253**Example** 1254 1255```ts 1256import { BusinessError } from '@ohos.base'; 1257 1258radio.getMEID((err: BusinessError, data: string) => { 1259 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 1260}); 1261``` 1262 1263 1264## radio.getMEID<sup>8+</sup> 1265 1266getMEID\(slotId: number, callback: AsyncCallback\<string\>\): void 1267 1268Obtains the MEID of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. 1269 1270**System API**: This is a system API. 1271 1272**Required permission**: ohos.permission.GET_TELEPHONY_STATE 1273 1274**System capability**: SystemCapability.Telephony.CoreService 1275 1276**Parameters** 1277 1278| Name | Type | Mandatory| Description | 1279| -------- | ----------------------- | ---- | -------------------------------------- | 1280| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 1281| callback | AsyncCallback\<string\> | Yes | Callback used to return the result. | 1282 1283**Error codes** 1284 1285For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 1286 1287| ID| Error Message | 1288| -------- | -------------------------------------------- | 1289| 201 | Permission denied. | 1290| 202 | Non-system applications use system APIs. | 1291| 401 | Parameter error. | 1292| 8300001 | Invalid parameter value. | 1293| 8300002 | Operation failed. Cannot connect to service. | 1294| 8300003 | System internal error. | 1295| 8300999 | Unknown error code. | 1296 1297**Example** 1298 1299```ts 1300import { BusinessError } from '@ohos.base'; 1301 1302let slotId: number = 0; 1303radio.getMEID(slotId, (err: BusinessError, data: string) => { 1304 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 1305}); 1306``` 1307 1308 1309## radio.getMEID<sup>8+</sup> 1310 1311getMEID\(slotId?: number\): Promise\<string\> 1312 1313Obtains the MEID of the SIM card in the specified slot. This API uses a promise to return the result. 1314 1315**System API**: This is a system API. 1316 1317**Required permission**: ohos.permission.GET_TELEPHONY_STATE 1318 1319**System capability**: SystemCapability.Telephony.CoreService 1320 1321**Parameters** 1322 1323| Name| Type | Mandatory| Description | 1324| ------ | ------ | ---- | -------------------------------------- | 1325| slotId | number | No | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 1326 1327**Return value** 1328 1329| Type | Description | 1330| ----------------- | --------------------------------------- | 1331| Promise\<string\> | Promise used to return the result.| 1332 1333**Error codes** 1334 1335For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 1336 1337| ID| Error Message | 1338| -------- | -------------------------------------------- | 1339| 201 | Permission denied. | 1340| 202 | Non-system applications use system APIs. | 1341| 401 | Parameter error. | 1342| 8300001 | Invalid parameter value. | 1343| 8300002 | Operation failed. Cannot connect to service. | 1344| 8300003 | System internal error. | 1345| 8300999 | Unknown error code. | 1346 1347**Example** 1348 1349```ts 1350import { BusinessError } from '@ohos.base'; 1351 1352let slotId: number = 0; 1353radio.getMEID(slotId).then((data: string) => { 1354 console.log(`getMEID success, promise: data->${JSON.stringify(data)}`); 1355}).catch((err: BusinessError) => { 1356 console.error(`getMEID failed, promise: err->${JSON.stringify(err)}`); 1357}); 1358``` 1359 1360## radio.getUniqueDeviceId<sup>8+</sup> 1361 1362getUniqueDeviceId\(callback: AsyncCallback\<string\>\): void 1363 1364Obtains the unique device ID of the SIM card. This API uses an asynchronous callback to return the result. 1365 1366**System API**: This is a system API. 1367 1368**Required permission**: ohos.permission.GET_TELEPHONY_STATE 1369 1370**System capability**: SystemCapability.Telephony.CoreService 1371 1372**Parameters** 1373 1374| Name | Type | Mandatory| Description | 1375| -------- | ----------------------- | ---- | ---------- | 1376| callback | AsyncCallback\<string\> | Yes | Callback used to return the result.| 1377 1378**Error codes** 1379 1380For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 1381 1382| ID| Error Message | 1383| -------- | -------------------------------------------- | 1384| 201 | Permission denied. | 1385| 202 | Non-system applications use system APIs. | 1386| 401 | Parameter error. | 1387| 8300001 | Invalid parameter value. | 1388| 8300002 | Operation failed. Cannot connect to service. | 1389| 8300003 | System internal error. | 1390| 8300999 | Unknown error code. | 1391 1392**Example** 1393 1394```ts 1395import { BusinessError } from '@ohos.base'; 1396 1397radio.getUniqueDeviceId((err: BusinessError, data: string) => { 1398 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 1399}); 1400``` 1401 1402 1403## radio.getUniqueDeviceId<sup>8+</sup> 1404 1405getUniqueDeviceId\(slotId: number, callback: AsyncCallback\<string\>\): void 1406 1407Obtains the unique device ID of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. 1408 1409**System API**: This is a system API. 1410 1411**Required permission**: ohos.permission.GET_TELEPHONY_STATE 1412 1413**System capability**: SystemCapability.Telephony.CoreService 1414 1415**Parameters** 1416 1417| Name | Type | Mandatory| Description | 1418| -------- | ----------------------- | ---- | -------------------------------------- | 1419| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 1420| callback | AsyncCallback\<string\> | Yes | Callback used to return the result. | 1421 1422**Error codes** 1423 1424For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 1425 1426| ID| Error Message | 1427| -------- | -------------------------------------------- | 1428| 201 | Permission denied. | 1429| 202 | Non-system applications use system APIs. | 1430| 401 | Parameter error. | 1431| 8300001 | Invalid parameter value. | 1432| 8300002 | Operation failed. Cannot connect to service. | 1433| 8300003 | System internal error. | 1434| 8300999 | Unknown error code. | 1435 1436**Example** 1437 1438```ts 1439import { BusinessError } from '@ohos.base'; 1440 1441let slotId: number = 0; 1442radio.getUniqueDeviceId(slotId, (err: BusinessError, data: string) => { 1443 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 1444}); 1445``` 1446 1447 1448## radio.getUniqueDeviceId<sup>8+</sup> 1449 1450getUniqueDeviceId\(slotId?: number\): Promise\<string\> 1451 1452Obtains the unique device ID of the SIM card in the specified slot. This API uses a promise to return the result. 1453 1454**System API**: This is a system API. 1455 1456**Required permission**: ohos.permission.GET_TELEPHONY_STATE 1457 1458**System capability**: SystemCapability.Telephony.CoreService 1459 1460**Parameters** 1461 1462| Name| Type | Mandatory| Description | 1463| ------ | ------ | ---- | -------------------------------------- | 1464| slotId | number | No | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 1465 1466**Return value** 1467 1468| Type | Description | 1469| ----------------- | --------------------------------------------- | 1470| Promise\<string\> | Promise used to return the result.| 1471 1472**Error codes** 1473 1474For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 1475 1476| ID| Error Message | 1477| -------- | -------------------------------------------- | 1478| 201 | Permission denied. | 1479| 202 | Non-system applications use system APIs. | 1480| 401 | Parameter error. | 1481| 8300001 | Invalid parameter value. | 1482| 8300002 | Operation failed. Cannot connect to service. | 1483| 8300003 | System internal error. | 1484| 8300999 | Unknown error code. | 1485 1486**Example** 1487 1488```ts 1489import { BusinessError } from '@ohos.base'; 1490 1491let slotId: number = 0; 1492radio.getUniqueDeviceId(slotId).then((data: string) => { 1493 console.log(`getUniqueDeviceId success, promise: data->${JSON.stringify(data)}`); 1494}).catch((err: BusinessError) => { 1495 console.error(`getUniqueDeviceId failed, promise: err->${JSON.stringify(err)}`); 1496}); 1497``` 1498 1499## radio.sendUpdateCellLocationRequest<sup>8+</sup> 1500 1501sendUpdateCellLocationRequest\(callback: AsyncCallback\<void\>\): void 1502 1503Sends a cell location update request. This API uses an asynchronous callback to return the result. 1504 1505**System API**: This is a system API. 1506 1507**Required permissions**: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION 1508 1509**System capability**: SystemCapability.Telephony.CoreService 1510 1511**Parameters** 1512 1513| Name | Type | Mandatory| Description | 1514| -------- | --------------------- | ---- | ---------- | 1515| callback | AsyncCallback\<void\> | Yes | Callback used to return the result.| 1516 1517**Error codes** 1518 1519For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 1520 1521| ID| Error Message | 1522| -------- | -------------------------------------------- | 1523| 201 | Permission denied. | 1524| 202 | Non-system applications use system APIs. | 1525| 401 | Parameter error. | 1526| 8300001 | Invalid parameter value. | 1527| 8300002 | Operation failed. Cannot connect to service. | 1528| 8300003 | System internal error. | 1529| 8300999 | Unknown error code. | 1530 1531**Example** 1532 1533```ts 1534import { BusinessError } from '@ohos.base'; 1535 1536radio.sendUpdateCellLocationRequest((err: BusinessError) => { 1537 console.log(`callback: err->${JSON.stringify(err)}`); 1538}); 1539``` 1540 1541## radio.sendUpdateCellLocationRequest<sup>8+</sup> 1542 1543sendUpdateCellLocationRequest\(slotId: number, callback: AsyncCallback\<void\>\): void 1544 1545Sends a cell location update request for the SIM card in the specified slot. This API uses an asynchronous callback to return the result. 1546 1547**System API**: This is a system API. 1548 1549**Required permissions**: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION 1550 1551**System capability**: SystemCapability.Telephony.CoreService 1552 1553**Parameters** 1554 1555| Name | Type | Mandatory| Description | 1556| -------- | --------------------- | ---- | ---------- | 1557| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 1558| callback | AsyncCallback\<void\> | Yes | Callback used to return the result.| 1559 1560**Error codes** 1561 1562For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 1563 1564| ID| Error Message | 1565| -------- | -------------------------------------------- | 1566| 201 | Permission denied. | 1567| 202 | Non-system applications use system APIs. | 1568| 401 | Parameter error. | 1569| 8300001 | Invalid parameter value. | 1570| 8300002 | Operation failed. Cannot connect to service. | 1571| 8300003 | System internal error. | 1572| 8300999 | Unknown error code. | 1573 1574**Example** 1575 1576```ts 1577import { BusinessError } from '@ohos.base'; 1578 1579let slotId: number = 0; 1580radio.sendUpdateCellLocationRequest(slotId, (err: BusinessError) => { 1581 console.log(`callback: err->${JSON.stringify(err)}`); 1582}); 1583``` 1584 1585## radio.sendUpdateCellLocationRequest<sup>8+</sup> 1586 1587sendUpdateCellLocationRequest\(slotId?: number\): Promise\<void\> 1588 1589Sends a cell location update request for the SIM card in the specified slot. This API uses a promise to return the result. 1590 1591**System API**: This is a system API. 1592 1593**Required permissions**: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION 1594 1595**System capability**: SystemCapability.Telephony.CoreService 1596 1597**Parameters** 1598 1599| Name| Type | Mandatory| Description | 1600| ------ | ------ | ---- | -------------------------------------- | 1601| slotId | number | No | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 1602 1603**Return value** 1604 1605| Type | Description | 1606| --------------- | ----------------------- | 1607| Promise\<void\> | Promise used to return the result.| 1608 1609**Error codes** 1610 1611For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 1612 1613| ID| Error Message | 1614| -------- | -------------------------------------------- | 1615| 201 | Permission denied. | 1616| 202 | Non-system applications use system APIs. | 1617| 401 | Parameter error. | 1618| 8300001 | Invalid parameter value. | 1619| 8300002 | Operation failed. Cannot connect to service. | 1620| 8300003 | System internal error. | 1621| 8300999 | Unknown error code. | 1622 1623**Example** 1624 1625```ts 1626import { BusinessError } from '@ohos.base'; 1627 1628let slotId: number = 0; 1629radio.sendUpdateCellLocationRequest(slotId).then(() => { 1630 console.log(`sendUpdateCellLocationRequest success.`); 1631}).catch((err: BusinessError) => { 1632 console.log(`sendUpdateCellLocationRequest failed, promise: err->${JSON.stringify(err)}`); 1633}); 1634``` 1635 1636## radio.getCellInformation<sup>8+</sup> 1637 1638getCellInformation\(callback: AsyncCallback\<Array\<CellInformation\>\>\): void 1639 1640Obtains cell information. This API uses an asynchronous callback to return the result. 1641 1642**System API**: This is a system API. 1643 1644**Required permissions**: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION 1645 1646**System capability**: SystemCapability.Telephony.CoreService 1647 1648**Parameters** 1649 1650| Name | Type | Mandatory| Description | 1651| -------- | ------------------------------------------------------------ | ---- | ------------------------ | 1652| callback | AsyncCallback\<Array<[CellInformation](#cellinformation8)\>\> | Yes | Callback used to return the result.| 1653 1654**Error codes** 1655 1656For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 1657 1658| ID| Error Message | 1659| -------- | -------------------------------------------- | 1660| 201 | Permission denied. | 1661| 202 | Non-system applications use system APIs. | 1662| 401 | Parameter error. | 1663| 8300001 | Invalid parameter value. | 1664| 8300002 | Operation failed. Cannot connect to service. | 1665| 8300003 | System internal error. | 1666| 8300999 | Unknown error code. | 1667 1668**Example** 1669 1670```ts 1671import { BusinessError } from '@ohos.base'; 1672 1673radio.getCellInformation((err: BusinessError, data: Array<radio.CellInformation>) => { 1674 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 1675}); 1676``` 1677 1678 1679## radio.getCellInformation<sup>8+</sup> 1680 1681getCellInformation\(slotId: number, callback: AsyncCallback\<Array\<CellInformation\>\>\): void 1682 1683Obtains cell information of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. 1684 1685**System API**: This is a system API. 1686 1687**Required permissions**: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION 1688 1689**System capability**: SystemCapability.Telephony.CoreService 1690 1691**Parameters** 1692 1693| Name | Type | Mandatory| Description | 1694| -------- | ------------------------------------------------------------ | ---- | -------------------------------------- | 1695| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 1696| callback | AsyncCallback\<Array<[CellInformation](#cellinformation8)\>\> | Yes | Callback used to return the result. | 1697 1698**Error codes** 1699 1700For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 1701 1702| ID| Error Message | 1703| -------- | -------------------------------------------- | 1704| 201 | Permission denied. | 1705| 202 | Non-system applications use system APIs. | 1706| 401 | Parameter error. | 1707| 8300001 | Invalid parameter value. | 1708| 8300002 | Operation failed. Cannot connect to service. | 1709| 8300003 | System internal error. | 1710| 8300999 | Unknown error code. | 1711 1712**Example** 1713 1714```ts 1715import { BusinessError } from '@ohos.base'; 1716 1717let slotId: number = 0; 1718radio.getCellInformation(slotId, (err: BusinessError, data: Array<radio.CellInformation>) => { 1719 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 1720}); 1721``` 1722 1723 1724## radio.getCellInformation<sup>8+</sup> 1725 1726getCellInformation\(slotId?: number\): Promise\<Array\<CellInformation\>\> 1727 1728Obtains cell information of the SIM card in the specified slot. This API uses a promise to return the result. 1729 1730**System API**: This is a system API. 1731 1732**Required permissions**: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION 1733 1734**System capability**: SystemCapability.Telephony.CoreService 1735 1736**Parameters** 1737 1738| Name| Type | Mandatory| Description | 1739| ------ | ------ | ---- | -------------------------------------- | 1740| slotId | number | No | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 1741 1742**Return value** 1743 1744| Type | Description | 1745| ------------------------------------------------------- | ----------------------- | 1746| Promise\<Array<[CellInformation](#cellinformation8)\>\> | Promise used to return the result.| 1747 1748**Error codes** 1749 1750For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 1751 1752| ID| Error Message | 1753| -------- | -------------------------------------------- | 1754| 201 | Permission denied. | 1755| 202 | Non-system applications use system APIs. | 1756| 401 | Parameter error. | 1757| 8300001 | Invalid parameter value. | 1758| 8300002 | Operation failed. Cannot connect to service. | 1759| 8300003 | System internal error. | 1760| 8300999 | Unknown error code. | 1761 1762**Example** 1763 1764```ts 1765import { BusinessError } from '@ohos.base'; 1766 1767let slotId: number = 0; 1768radio.getCellInformation(slotId).then((data: Array<radio.CellInformation>) => { 1769 console.log(`getCellInformation success, promise: data->${JSON.stringify(data)}`); 1770}).catch((err: BusinessError) => { 1771 console.error(`getCellInformation failed, promise: err->${JSON.stringify(err)}`); 1772}); 1773``` 1774 1775## radio.setNetworkSelectionMode 1776 1777setNetworkSelectionMode\(options: NetworkSelectionModeOptions, callback: AsyncCallback\<void\>\): void 1778 1779Sets the network selection mode. This API uses an asynchronous callback to return the result. 1780 1781**System API**: This is a system API. 1782 1783**Required permission**: ohos.permission.SET_TELEPHONY_STATE 1784 1785**System capability**: SystemCapability.Telephony.CoreService 1786 1787**Parameters** 1788 1789| Name | Type | Mandatory| Description | 1790| -------- | ----------------------------------------------------------- | ---- | ------------------ | 1791| options | [NetworkSelectionModeOptions](#networkselectionmodeoptions) | Yes | Network selection mode.| 1792| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. | 1793 1794**Error codes** 1795 1796For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 1797 1798| ID| Error Message | 1799| -------- | -------------------------------------------- | 1800| 201 | Permission denied. | 1801| 202 | Non-system applications use system APIs. | 1802| 401 | Parameter error. | 1803| 8300001 | Invalid parameter value. | 1804| 8300002 | Operation failed. Cannot connect to service. | 1805| 8300003 | System internal error. | 1806| 8300999 | Unknown error code. | 1807 1808**Example** 1809 1810```ts 1811import { BusinessError } from '@ohos.base'; 1812 1813let networkInformation: radio.NetworkInformation = { 1814 operatorName: "China Mobile", 1815 operatorNumeric: "898600", 1816 state: radio.NetworkInformationState.NETWORK_AVAILABLE, 1817 radioTech: "CS" 1818} 1819let networkSelectionModeOptions: radio.NetworkSelectionModeOptions = { 1820 slotId: 0, 1821 selectMode: radio.NetworkSelectionMode.NETWORK_SELECTION_AUTOMATIC, 1822 networkInformation: networkInformation, 1823 resumeSelection: true 1824} 1825radio.setNetworkSelectionMode(networkSelectionModeOptions, (err: BusinessError) => { 1826 console.log(`callback: err->${JSON.stringify(err)}`); 1827}); 1828``` 1829 1830## radio.setNetworkSelectionMode 1831 1832setNetworkSelectionMode\(options: NetworkSelectionModeOptions\): Promise\<void\> 1833 1834Sets the network selection mode. This API uses a promise to return the result. 1835 1836**System API**: This is a system API. 1837 1838**Required permission**: ohos.permission.SET_TELEPHONY_STATE 1839 1840**System capability**: SystemCapability.Telephony.CoreService 1841 1842**Parameters** 1843 1844| Name | Type | Mandatory| Description | 1845| ------- | ----------------------------------------------------------- | ---- | ------------------ | 1846| options | [NetworkSelectionModeOptions](#networkselectionmodeoptions) | Yes | Network selection mode.| 1847 1848**Return value** 1849 1850| Type | Description | 1851| --------------- | ----------------------- | 1852| Promise\<void\> | Promise used to return the result.| 1853 1854**Error codes** 1855 1856For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 1857 1858| ID| Error Message | 1859| -------- | -------------------------------------------- | 1860| 201 | Permission denied. | 1861| 202 | Non-system applications use system APIs. | 1862| 401 | Parameter error. | 1863| 8300001 | Invalid parameter value. | 1864| 8300002 | Operation failed. Cannot connect to service. | 1865| 8300003 | System internal error. | 1866| 8300999 | Unknown error code. | 1867 1868**Example** 1869 1870```ts 1871import { BusinessError } from '@ohos.base'; 1872 1873let networkInformation: radio.NetworkInformation = { 1874 operatorName: "China Mobile", 1875 operatorNumeric: "898600", 1876 state: radio.NetworkInformationState.NETWORK_AVAILABLE, 1877 radioTech: "CS" 1878} 1879let networkSelectionModeOptions: radio.NetworkSelectionModeOptions = { 1880 slotId: 0, 1881 selectMode: radio.NetworkSelectionMode.NETWORK_SELECTION_AUTOMATIC, 1882 networkInformation: networkInformation, 1883 resumeSelection: true 1884} 1885radio.setNetworkSelectionMode(networkSelectionModeOptions).then(() => { 1886 console.log(`setNetworkSelectionMode success.`); 1887}).catch((err: BusinessError) => { 1888 console.log(`setNetworkSelectionMode failed, promise: err->${JSON.stringify(err)}`); 1889}); 1890``` 1891 1892## radio.getNetworkSearchInformation 1893 1894getNetworkSearchInformation\(slotId: number, callback: AsyncCallback\<NetworkSearchResult\>\): void 1895 1896Obtains network search information of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. 1897 1898**System API**: This is a system API. 1899 1900**Required permission**: ohos.permission.GET_TELEPHONY_STATE 1901 1902**System capability**: SystemCapability.Telephony.CoreService 1903 1904**Parameters** 1905 1906| Name | Type | Mandatory| Description | 1907| -------- | ------------------------------------------------------------ | ---- | -------------------------------------- | 1908| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 1909| callback | AsyncCallback\<[NetworkSearchResult](#networksearchresult)\> | Yes | Callback used to return the result. | 1910 1911**Error codes** 1912 1913For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 1914 1915| ID| Error Message | 1916| -------- | -------------------------------------------- | 1917| 201 | Permission denied. | 1918| 202 | Non-system applications use system APIs. | 1919| 401 | Parameter error. | 1920| 8300001 | Invalid parameter value. | 1921| 8300002 | Operation failed. Cannot connect to service. | 1922| 8300003 | System internal error. | 1923| 8300999 | Unknown error code. | 1924 1925**Example** 1926 1927```ts 1928import { BusinessError } from '@ohos.base'; 1929 1930radio.getNetworkSearchInformation(0, (err: BusinessError, data: radio.NetworkSearchResult) => { 1931 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 1932}); 1933``` 1934 1935## radio.getNetworkSearchInformation 1936 1937getNetworkSearchInformation\(slotId: number\): Promise\<NetworkSearchResult\> 1938 1939Obtains network search information of the SIM card in the specified slot. This API uses a promise to return the result. 1940 1941**System API**: This is a system API. 1942 1943**Required permission**: ohos.permission.GET_TELEPHONY_STATE 1944 1945**System capability**: SystemCapability.Telephony.CoreService 1946 1947**Parameters** 1948 1949| Name| Type | Mandatory| Description | 1950| ------ | ------ | ---- | -------------------------------------- | 1951| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 1952 1953**Return value** 1954 1955| Type | Description | 1956| ------------------------------------------------------ | ----------------------- | 1957| Promise\<[NetworkSearchResult](#networksearchresult)\> | Promise used to return the result.| 1958 1959**Error codes** 1960 1961For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 1962 1963| ID| Error Message | 1964| -------- | -------------------------------------------- | 1965| 201 | Permission denied. | 1966| 202 | Non-system applications use system APIs. | 1967| 401 | Parameter error. | 1968| 8300001 | Invalid parameter value. | 1969| 8300002 | Operation failed. Cannot connect to service. | 1970| 8300003 | System internal error. | 1971| 8300999 | Unknown error code. | 1972 1973**Example** 1974 1975```ts 1976import { BusinessError } from '@ohos.base'; 1977 1978radio.getNetworkSearchInformation(0).then((data: radio.NetworkSearchResult) => { 1979 console.log(`getNetworkSearchInformation success, promise: data->${JSON.stringify(data)}`); 1980}).catch((err: BusinessError) => { 1981 console.log(`getNetworkSearchInformation failed, promise: err->${JSON.stringify(err)}`); 1982}); 1983``` 1984 1985## radio.getNrOptionMode<sup>(deprecated)</sup> 1986 1987getNrOptionMode\(callback: AsyncCallback\<NrOptionMode\>\): void 1988 1989Obtains the NR option mode. This API uses an asynchronous callback to return the result. 1990 1991> **NOTE** 1992> 1993> This API is supported since API version 8 and deprecated since API version 10. You are advised to use [getNROptionMode](#radiogetnroptionmode10). 1994 1995**System API**: This is a system API. 1996 1997**System capability**: SystemCapability.Telephony.CoreService 1998 1999**Parameters** 2000 2001| Name | Type | Mandatory| Description | 2002| -------- | ----------------------------------------------- | ---- | ---------- | 2003| callback | AsyncCallback\<[NrOptionMode](#nroptionmodedeprecated)\> | Yes | Callback used to return the result.| 2004 2005**Error codes** 2006 2007For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 2008 2009| ID| Error Message | 2010| -------- | -------------------------------------------- | 2011| 202 | Non-system applications use system APIs. | 2012| 401 | Parameter error. | 2013| 8300001 | Invalid parameter value. | 2014| 8300002 | Operation failed. Cannot connect to service. | 2015| 8300003 | System internal error. | 2016| 8300999 | Unknown error code. | 2017 2018**Example** 2019 2020```ts 2021import { BusinessError } from '@ohos.base'; 2022 2023radio.getNrOptionMode((err: BusinessError, data: radio.NrOptionMode) => { 2024 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 2025}); 2026``` 2027 2028 2029## radio.getNrOptionMode<sup>(deprecated)</sup> 2030 2031getNrOptionMode\(slotId: number, callback: AsyncCallback\<NrOptionMode\>\): void 2032 2033Obtains the NR option mode of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. 2034 2035> **NOTE** 2036> 2037> This API is supported since API version 8 and deprecated since API version 10. You are advised to use [getNROptionMode](#radiogetnroptionmode10). 2038 2039**System API**: This is a system API. 2040 2041**System capability**: SystemCapability.Telephony.CoreService 2042 2043**Parameters** 2044 2045| Name | Type | Mandatory| Description | 2046| -------- | ----------------------------------------------- | ---- | ------------------------------------- | 2047| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 2048| callback | AsyncCallback\<[NrOptionMode](#nroptionmodedeprecated)\> | Yes | Callback used to return the result. | 2049 2050**Error codes** 2051 2052For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 2053 2054| ID| Error Message | 2055| -------- | -------------------------------------------- | 2056| 202 | Non-system applications use system APIs. | 2057| 401 | Parameter error. | 2058| 8300001 | Invalid parameter value. | 2059| 8300002 | Operation failed. Cannot connect to service. | 2060| 8300003 | System internal error. | 2061| 8300999 | Unknown error code. | 2062 2063**Example** 2064 2065```ts 2066import { BusinessError } from '@ohos.base'; 2067 2068let slotId: number = 0; 2069radio.getNrOptionMode(slotId, (err: BusinessError, data: radio.NrOptionMode) => { 2070 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 2071}); 2072``` 2073 2074 2075## radio.getNrOptionMode<sup>(deprecated)</sup> 2076 2077getNrOptionMode\(slotId?: number\): Promise\<NrOptionMode\> 2078 2079Obtains the NR option mode of the SIM card in the specified slot. This API uses a promise to return the result. 2080 2081> **NOTE** 2082> 2083> This API is supported since API version 8 and deprecated since API version 10. You are advised to use [getNROptionMode](#radiogetnroptionmode10). 2084 2085**System API**: This is a system API. 2086 2087**System capability**: SystemCapability.Telephony.CoreService 2088 2089**Parameters** 2090 2091| Name| Type | Mandatory| Description | 2092| ------ | ------ | ---- | -------------------------------------- | 2093| slotId | number | No | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 2094 2095**Return value** 2096 2097| Type | Description | 2098| -------------------------------------------------- | ----------------------- | 2099| Promise\<[NrOptionMode](#nroptionmodedeprecated)\> | Promise used to return the result. | 2100 2101**Error codes** 2102 2103For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 2104 2105| ID| Error Message | 2106| -------- | -------------------------------------------- | 2107| 202 | Non-system applications use system APIs. | 2108| 401 | Parameter error. | 2109| 8300001 | Invalid parameter value. | 2110| 8300002 | Operation failed. Cannot connect to service. | 2111| 8300003 | System internal error. | 2112| 8300999 | Unknown error code. | 2113 2114**Example** 2115 2116```ts 2117import { BusinessError } from '@ohos.base'; 2118 2119let slotId: number = 0; 2120radio.getNrOptionMode(slotId).then((data: radio.NrOptionMode) => { 2121 console.log(`getNrOptionMode success, promise: data->${JSON.stringify(data)}`); 2122}).catch((err: BusinessError) => { 2123 console.error(`getNrOptionMode failed, promise: err->${JSON.stringify(err)}`); 2124}); 2125``` 2126 2127## radio.turnOnRadio<sup>7+</sup> 2128 2129turnOnRadio\(callback: AsyncCallback\<void\>\): void 2130 2131Turns on the radio function. This API uses an asynchronous callback to return the result. 2132 2133**System API**: This is a system API. 2134 2135**Required permission**: ohos.permission.SET_TELEPHONY_STATE 2136 2137**System capability**: SystemCapability.Telephony.CoreService 2138 2139**Parameters** 2140 2141| Name | Type | Mandatory| Description | 2142| -------- | --------------------- | ---- | ---------- | 2143| callback | AsyncCallback\<void\> | Yes | Callback used to return the result.| 2144 2145**Error codes** 2146 2147For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 2148 2149| ID| Error Message | 2150| -------- | -------------------------------------------- | 2151| 201 | Permission denied. | 2152| 202 | Non-system applications use system APIs. | 2153| 401 | Parameter error. | 2154| 8300001 | Invalid parameter value. | 2155| 8300002 | Operation failed. Cannot connect to service. | 2156| 8300003 | System internal error. | 2157| 8300999 | Unknown error code. | 2158 2159**Example** 2160 2161```ts 2162import { BusinessError } from '@ohos.base'; 2163 2164radio.turnOnRadio((err: BusinessError) => { 2165 console.log(`callback: err->${JSON.stringify(err)}`); 2166}); 2167``` 2168 2169 2170## radio.turnOnRadio<sup>7+</sup> 2171 2172turnOnRadio\(slotId: number, callback: AsyncCallback\<void\>\): void 2173 2174Turns on the radio function for the SIM card in the specified slot. This API uses an asynchronous callback to return the result. 2175 2176**System API**: This is a system API. 2177 2178**Required permission**: ohos.permission.SET_TELEPHONY_STATE 2179 2180**System capability**: SystemCapability.Telephony.CoreService 2181 2182**Parameters** 2183 2184| Name | Type | Mandatory| Description | 2185| -------- | --------------------- | ---- | -------------------------------------- | 2186| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 2187| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. | 2188 2189**Error codes** 2190 2191For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 2192 2193| ID| Error Message | 2194| -------- | -------------------------------------------- | 2195| 201 | Permission denied. | 2196| 202 | Non-system applications use system APIs. | 2197| 401 | Parameter error. | 2198| 8300001 | Invalid parameter value. | 2199| 8300002 | Operation failed. Cannot connect to service. | 2200| 8300003 | System internal error. | 2201| 8300999 | Unknown error code. | 2202 2203**Example** 2204 2205```ts 2206import { BusinessError } from '@ohos.base'; 2207 2208let slotId: number = 0; 2209radio.turnOnRadio(slotId, (err: BusinessError) => { 2210 console.log(`callback: err->${JSON.stringify(err)}`); 2211}); 2212``` 2213 2214 2215## radio.turnOnRadio<sup>7+</sup> 2216 2217turnOnRadio(slotId?: number): Promise\<void\> 2218 2219Turns on the radio function for the SIM card in the specified slot. This API uses a promise to return the result. 2220 2221**System API**: This is a system API. 2222 2223**Required permission**: ohos.permission.SET_TELEPHONY_STATE 2224 2225**System capability**: SystemCapability.Telephony.CoreService 2226 2227**Parameters** 2228 2229| Name| Type | Mandatory| Description | 2230| ------ | ------ | ---- | -------------------------------------- | 2231| slotId | number | No | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 2232 2233**Return value** 2234 2235| Type | Description | 2236| --------------- | ----------------------- | 2237| Promise\<void\> | Promise used to return the result.| 2238 2239**Error codes** 2240 2241For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 2242 2243| ID| Error Message | 2244| -------- | -------------------------------------------- | 2245| 201 | Permission denied. | 2246| 202 | Non-system applications use system APIs. | 2247| 401 | Parameter error. | 2248| 8300001 | Invalid parameter value. | 2249| 8300002 | Operation failed. Cannot connect to service. | 2250| 8300003 | System internal error. | 2251| 8300999 | Unknown error code. | 2252 2253**Example** 2254 2255```ts 2256import { BusinessError } from '@ohos.base'; 2257 2258let slotId: number = 0; 2259radio.turnOnRadio(slotId).then(() => { 2260 console.log(`turnOnRadio success.`); 2261}).catch((err: BusinessError) => { 2262 console.error(`turnOnRadio failed, promise: err->${JSON.stringify(err)}`); 2263}); 2264``` 2265 2266## radio.turnOffRadio<sup>7+</sup> 2267 2268turnOffRadio\(callback: AsyncCallback\<void\>\): void 2269 2270Turns off the radio function. This API uses an asynchronous callback to return the result. 2271 2272**System API**: This is a system API. 2273 2274**Required permission**: ohos.permission.SET_TELEPHONY_STATE 2275 2276**System capability**: SystemCapability.Telephony.CoreService 2277 2278**Parameters** 2279 2280| Name | Type | Mandatory| Description | 2281| -------- | --------------------- | ---- | ---------- | 2282| callback | AsyncCallback\<void\> | Yes | Callback used to return the result.| 2283 2284**Error codes** 2285 2286For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 2287 2288| ID| Error Message | 2289| -------- | -------------------------------------------- | 2290| 201 | Permission denied. | 2291| 202 | Non-system applications use system APIs. | 2292| 401 | Parameter error. | 2293| 8300001 | Invalid parameter value. | 2294| 8300002 | Operation failed. Cannot connect to service. | 2295| 8300003 | System internal error. | 2296| 8300999 | Unknown error code. | 2297 2298**Example** 2299 2300```ts 2301import { BusinessError } from '@ohos.base'; 2302 2303radio.turnOffRadio((err: BusinessError) => { 2304 console.log(`callback: err->${JSON.stringify(err)}`); 2305}); 2306``` 2307 2308 2309## radio.turnOffRadio<sup>7+</sup> 2310 2311turnOffRadio\(slotId: number, callback: AsyncCallback\<void\>\): void 2312 2313Turns off the radio function for the SIM card in the specified slot. This API uses an asynchronous callback to return the result. 2314 2315**System API**: This is a system API. 2316 2317**Required permission**: ohos.permission.SET_TELEPHONY_STATE 2318 2319**System capability**: SystemCapability.Telephony.CoreService 2320 2321**Parameters** 2322 2323| Name | Type | Mandatory| Description | 2324| -------- | --------------------- | ---- | -------------------------------------- | 2325| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 2326| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. | 2327 2328**Error codes** 2329 2330For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 2331 2332| ID| Error Message | 2333| -------- | -------------------------------------------- | 2334| 201 | Permission denied. | 2335| 202 | Non-system applications use system APIs. | 2336| 401 | Parameter error. | 2337| 8300001 | Invalid parameter value. | 2338| 8300002 | Operation failed. Cannot connect to service. | 2339| 8300003 | System internal error. | 2340| 8300999 | Unknown error code. | 2341 2342**Example** 2343 2344```ts 2345import { BusinessError } from '@ohos.base'; 2346 2347let slotId: number = 0; 2348radio.turnOffRadio(slotId, (err: BusinessError) => { 2349 console.log(`callback: err->${JSON.stringify(err)}`); 2350}); 2351``` 2352 2353 2354## radio.turnOffRadio<sup>7+</sup> 2355 2356turnOffRadio\(slotId?: number\): Promise\<void\> 2357 2358Turns off the radio function for the SIM card in the specified slot. This API uses a promise to return the result. 2359 2360**System API**: This is a system API. 2361 2362**Required permission**: ohos.permission.SET_TELEPHONY_STATE 2363 2364**System capability**: SystemCapability.Telephony.CoreService 2365 2366**Parameters** 2367 2368| Name| Type | Mandatory| Description | 2369| ------ | ------ | ---- | -------------------------------------- | 2370| slotId | number | No | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 2371 2372**Return value** 2373 2374| Type | Description | 2375| --------------- | ----------------------- | 2376| Promise\<void\> | Promise used to return the result.| 2377 2378**Error codes** 2379 2380For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 2381 2382| ID| Error Message | 2383| -------- | -------------------------------------------- | 2384| 201 | Permission denied. | 2385| 202 | Non-system applications use system APIs. | 2386| 401 | Parameter error. | 2387| 8300001 | Invalid parameter value. | 2388| 8300002 | Operation failed. Cannot connect to service. | 2389| 8300003 | System internal error. | 2390| 8300999 | Unknown error code. | 2391 2392**Example** 2393 2394```ts 2395import { BusinessError } from '@ohos.base'; 2396 2397let slotId: number = 0; 2398radio.turnOffRadio(slotId).then(() => { 2399 console.log(`turnOffRadio success.`); 2400}).catch((err: BusinessError) => { 2401 console.error(`turnOffRadio failed, promise: err->${JSON.stringify(err)}`); 2402}); 2403``` 2404 2405## radio.setPreferredNetwork<sup>8+</sup> 2406 2407setPreferredNetwork\(slotId: number, networkMode: PreferredNetworkMode, callback: AsyncCallback\<void\>\): void 2408 2409Sets the preferred network of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. 2410 2411**System API**: This is a system API. 2412 2413**Required permission**: ohos.permission.SET_TELEPHONY_STATE 2414 2415**System capability**: SystemCapability.Telephony.CoreService 2416 2417**Parameters** 2418 2419| Name | Type | Mandatory| Description | 2420| ----------- | ---------------------------------------------- | ---- | -------------------------------------- | 2421| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 2422| networkMode | [PreferredNetworkMode](#preferrednetworkmode8) | Yes | Preferred network mode. | 2423| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. | 2424 2425**Error codes** 2426 2427For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 2428 2429| ID| Error Message | 2430| -------- | -------------------------------------------- | 2431| 201 | Permission denied. | 2432| 202 | Non-system applications use system APIs. | 2433| 401 | Parameter error. | 2434| 8300001 | Invalid parameter value. | 2435| 8300002 | Operation failed. Cannot connect to service. | 2436| 8300003 | System internal error. | 2437| 8300999 | Unknown error code. | 2438 2439**Example** 2440 2441```ts 2442import { BusinessError } from '@ohos.base'; 2443 2444let slotId: number = 0; 2445let mode: radio.PreferredNetworkMode = radio.PreferredNetworkMode.PREFERRED_NETWORK_MODE_GSM; 2446radio.setPreferredNetwork(slotId, mode, (err: BusinessError) => { 2447 console.log(`callback: err->${JSON.stringify(err)}`); 2448}); 2449``` 2450 2451## radio.setPreferredNetwork<sup>8+</sup> 2452 2453setPreferredNetwork\(slotId: number, networkMode: PreferredNetworkMode\): Promise\<void\> 2454 2455Sets the preferred network of the SIM card in the specified slot. This API uses a promise to return the result. 2456 2457**System API**: This is a system API. 2458 2459**Required permission**: ohos.permission.SET_TELEPHONY_STATE 2460 2461**System capability**: SystemCapability.Telephony.CoreService 2462 2463**Parameters** 2464 2465| Name | Type | Mandatory| Description | 2466| ----------- | ---------------------------------------------- | ---- | -------------------------------------- | 2467| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 2468| networkMode | [PreferredNetworkMode](#preferrednetworkmode8) | Yes | Preferred network mode. | 2469 2470**Return value** 2471 2472| Type | Description | 2473| --------------- | ----------------------- | 2474| Promise\<void\> | Promise used to return the result.| 2475 2476**Error codes** 2477 2478For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 2479 2480| ID| Error Message | 2481| -------- | -------------------------------------------- | 2482| 201 | Permission denied. | 2483| 202 | Non-system applications use system APIs. | 2484| 401 | Parameter error. | 2485| 8300001 | Invalid parameter value. | 2486| 8300002 | Operation failed. Cannot connect to service. | 2487| 8300003 | System internal error. | 2488| 8300999 | Unknown error code. | 2489 2490**Example** 2491 2492```ts 2493import { BusinessError } from '@ohos.base'; 2494 2495let slotId: number = 0; 2496let mode: radio.PreferredNetworkMode = radio.PreferredNetworkMode.PREFERRED_NETWORK_MODE_GSM; 2497radio.setPreferredNetwork(slotId, mode).then(() => { 2498 console.log(`setPreferredNetwork success.`); 2499}).catch((err: BusinessError) => { 2500 console.log(`setPreferredNetwork failed, promise: err->${JSON.stringify(err)}`); 2501}); 2502``` 2503 2504## radio.getPreferredNetwork<sup>8+</sup> 2505 2506getPreferredNetwork\(slotId: number, callback: AsyncCallback\<PreferredNetworkMode\>\): void 2507 2508Obtains the preferred network of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. 2509 2510**System API**: This is a system API. 2511 2512**Required permission**: ohos.permission.GET_TELEPHONY_STATE 2513 2514**System capability**: SystemCapability.Telephony.CoreService 2515 2516**Parameters** 2517 2518| Name | Type | Mandatory| Description | 2519| -------- | --------------------------------------------------------------- | ---- | -------------------------------------- | 2520| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 2521| callback | AsyncCallback\<[PreferredNetworkMode](#preferrednetworkmode8)\> | Yes | Callback used to return the result. | 2522 2523**Error codes** 2524 2525For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 2526 2527| ID| Error Message | 2528| -------- | -------------------------------------------- | 2529| 201 | Permission denied. | 2530| 202 | Non-system applications use system APIs. | 2531| 401 | Parameter error. | 2532| 8300001 | Invalid parameter value. | 2533| 8300002 | Operation failed. Cannot connect to service. | 2534| 8300003 | System internal error. | 2535| 8300999 | Unknown error code. | 2536 2537**Example** 2538 2539```ts 2540import { BusinessError } from '@ohos.base'; 2541 2542let slotId: number = 0; 2543radio.getPreferredNetwork(slotId, (err: BusinessError, data: radio.PreferredNetworkMode) => { 2544 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 2545}); 2546``` 2547 2548## radio.getPreferredNetwork<sup>8+</sup> 2549 2550getPreferredNetwork\(slotId: number\): Promise\<PreferredNetworkMode\> 2551 2552Obtains the preferred network of the SIM card in the specified slot. This API uses a promise to return the result. 2553 2554**System API**: This is a system API. 2555 2556**Required permission**: ohos.permission.GET_TELEPHONY_STATE 2557 2558**System capability**: SystemCapability.Telephony.CoreService 2559 2560**Parameters** 2561 2562| Name| Type | Mandatory| Description | 2563| ------ | ------ | ---- | -------------------------------------- | 2564| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 2565 2566**Return value** 2567 2568| Type | Description | 2569| --------------- | ----------------------- | 2570| Promise\<[PreferredNetworkMode](#preferrednetworkmode8)\> | Promise used to return the result.| 2571 2572**Error codes** 2573 2574For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 2575 2576| ID| Error Message | 2577| -------- | -------------------------------------------- | 2578| 201 | Permission denied. | 2579| 202 | Non-system applications use system APIs. | 2580| 401 | Parameter error. | 2581| 8300001 | Invalid parameter value. | 2582| 8300002 | Operation failed. Cannot connect to service. | 2583| 8300003 | System internal error. | 2584| 8300999 | Unknown error code. | 2585 2586**Example** 2587 2588```ts 2589import { BusinessError } from '@ohos.base'; 2590 2591let slotId: number = 0; 2592radio.getPreferredNetwork(slotId).then((data: radio.PreferredNetworkMode) => { 2593 console.log(`getPreferredNetwork success, promise: data->${JSON.stringify(data)}`); 2594}).catch((err: BusinessError) => { 2595 console.log(`getPreferredNetwork failed, promise: err->${JSON.stringify(err)}`); 2596}); 2597``` 2598 2599## radio.getImsRegInfo<sup>9+</sup> 2600 2601getImsRegInfo\(slotId: number, imsType: ImsServiceType, callback: AsyncCallback\<ImsRegInfo\>\): void 2602 2603Obtains the IMS registration status of the specified IMS service type for the SIM card in the specified slot. This API uses an asynchronous callback to return the result. 2604 2605**System API**: This is a system API. 2606 2607**Required permission**: ohos.permission.GET_TELEPHONY_STATE 2608 2609**System capability**: SystemCapability.Telephony.CoreService 2610 2611**Parameters** 2612 2613| Name | Type | Mandatory| Description | 2614| -------- | ------------------------------------------ | ---- | -------------------------------------- | 2615| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 2616| imsType | [ImsServiceType](#imsservicetype9) | Yes | IMS service type. | 2617| callback | AsyncCallback<[ImsRegInfo](#imsreginfo9)\> | Yes | Callback used to return the result. | 2618 2619**Error codes** 2620 2621For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 2622 2623| ID| Error Message | 2624| -------- | -------------------------------------------- | 2625| 201 | Permission denied. | 2626| 202 | Non-system applications use system APIs. | 2627| 401 | Parameter error. | 2628| 8300001 | Invalid parameter value. | 2629| 8300002 | Operation failed. Cannot connect to service. | 2630| 8300003 | System internal error. | 2631| 8300999 | Unknown error code. | 2632 2633**Example** 2634 2635```ts 2636import { BusinessError } from '@ohos.base'; 2637 2638let slotId: number = 0; 2639let mode: radio.ImsServiceType = radio.ImsServiceType.TYPE_VIDEO; 2640radio.getImsRegInfo(slotId, mode, (err: BusinessError, data: radio.ImsRegInfo) => { 2641 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 2642}); 2643``` 2644 2645## radio.getImsRegInfo<sup>9+</sup> 2646 2647getImsRegInfo\(slotId: number, imsType: ImsServiceType\): Promise\<ImsRegInfo\> 2648 2649Obtains the IMS registration status of the specified IMS service type for the SIM card in the specified slot. This API uses a promise to return the result. 2650 2651**System API**: This is a system API. 2652 2653**Required permission**: ohos.permission.GET_TELEPHONY_STATE 2654 2655**System capability**: SystemCapability.Telephony.CoreService 2656 2657**Parameters** 2658 2659| Name | Type | Mandatory| Description | 2660| ------- | ---------------------------------- | ---- | -------------------------------------- | 2661| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 2662| imsType | [ImsServiceType](#imsservicetype9) | Yes | IMS service type. | 2663 2664**Return value** 2665 2666| Type | Description | 2667| ------------------------------------- | ----------------------- | 2668| Promise\<[ImsRegInfo](#imsreginfo9)\> | Promise used to return the result.| 2669 2670**Error codes** 2671 2672For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 2673 2674| ID| Error Message | 2675| -------- | -------------------------------------------- | 2676| 201 | Permission denied. | 2677| 202 | Non-system applications use system APIs. | 2678| 401 | Parameter error. | 2679| 8300001 | Invalid parameter value. | 2680| 8300002 | Operation failed. Cannot connect to service. | 2681| 8300003 | System internal error. | 2682| 8300999 | Unknown error code. | 2683 2684**Example** 2685 2686```ts 2687import { BusinessError } from '@ohos.base'; 2688 2689let slotId: number = 0; 2690let mode: radio.ImsServiceType = radio.ImsServiceType.TYPE_VIDEO; 2691radio.getImsRegInfo(slotId, mode).then((data: radio.ImsRegInfo) => { 2692 console.log(`getImsRegInfo success, promise: data->${JSON.stringify(data)}`); 2693}).catch((err: BusinessError) => { 2694 console.log(`getImsRegInfo failed, promise: err->${JSON.stringify(err)}`); 2695}); 2696``` 2697 2698## radio.on('imsRegStateChange')<sup>9+</sup> 2699 2700on\(type: 'imsRegStateChange', slotId: number, imsType: ImsServiceType, callback: Callback\<ImsRegInfo\>\): void 2701 2702Enables listening for **imsRegStateChange** events of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. 2703 2704**System API**: This is a system API. 2705 2706**Required permission**: ohos.permission.GET_TELEPHONY_STATE 2707 2708**System capability**: SystemCapability.Telephony.CoreService 2709 2710**Parameters** 2711 2712| Name | Type | Mandatory| Description | 2713| -------- | ------------------------------------ | ---- | -------------------------------------- | 2714| type | string | Yes | IMS registration status changes. | 2715| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 2716| imsType | [ImsServiceType](#imsservicetype9) | Yes | IMS service type. | 2717| callback | Callback<[ImsRegInfo](#imsreginfo9)> | Yes | Callback used to return the result. | 2718 2719**Error codes** 2720 2721For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 2722 2723| ID| Error Message | 2724| -------- | -------------------------------------------- | 2725| 201 | Permission denied. | 2726| 202 | Non-system applications use system APIs. | 2727| 401 | Parameter error. | 2728| 8300001 | Invalid parameter value. | 2729| 8300002 | Operation failed. Cannot connect to service. | 2730| 8300003 | System internal error. | 2731| 8300999 | Unknown error code. | 2732 2733**Example** 2734 2735```ts 2736import { BusinessError } from '@ohos.base'; 2737 2738let slotId: number = 0; 2739let mode: radio.ImsServiceType = radio.ImsServiceType.TYPE_VIDEO; 2740radio.on('imsRegStateChange', slotId, mode, (data: radio.ImsRegInfo) => { 2741 console.log(`callback: data->${JSON.stringify(data)}`); 2742}); 2743``` 2744 2745## radio.off('imsRegStateChange')<sup>9+</sup> 2746 2747off\(type: 'imsRegStateChange', slotId: number, imsType: ImsServiceType, callback?: Callback\<ImsRegInfo\>\): void 2748 2749Disables listening for **imsRegStateChange** events of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. 2750 2751**System API**: This is a system API. 2752 2753**Required permission**: ohos.permission.GET_TELEPHONY_STATE 2754 2755**System capability**: SystemCapability.Telephony.CoreService 2756 2757**Parameters** 2758 2759| Name | Type | Mandatory| Description | 2760| -------- | ------------------------------------ | ---- | -------------------------------------- | 2761| type | string | Yes | IMS registration status changes. | 2762| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 2763| imsType | [ImsServiceType](#imsservicetype9) | Yes | IMS service type. | 2764| callback | Callback<[ImsRegInfo](#imsreginfo9)> | No | Callback used to return the result. If this parameter is not set, the API unsubscribes from all callbacks.| 2765 2766**Error codes** 2767 2768For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 2769 2770| ID| Error Message | 2771| -------- | -------------------------------------------- | 2772| 201 | Permission denied. | 2773| 202 | Non-system applications use system APIs. | 2774| 401 | Parameter error. | 2775| 8300001 | Invalid parameter value. | 2776| 8300002 | Operation failed. Cannot connect to service. | 2777| 8300003 | System internal error. | 2778| 8300999 | Unknown error code. | 2779 2780**Example** 2781 2782```ts 2783import { BusinessError } from '@ohos.base'; 2784 2785let slotId: number = 0; 2786let mode: radio.ImsServiceType = radio.ImsServiceType.TYPE_VIDEO; 2787radio.off('imsRegStateChange', slotId, mode, (data: radio.ImsRegInfo) => { 2788 console.log(`callback: data->${JSON.stringify(data)}`); 2789}); 2790``` 2791 2792 2793## radio.getBasebandVersion<sup>10+</sup> 2794 2795getBasebandVersion\(slotId: number, callback: AsyncCallback\<string\>\): void 2796 2797Obtains the device baseband version of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. 2798 2799**System API**: This is a system API. 2800 2801**Required permission**: ohos.permission.GET_TELEPHONY_STATE 2802 2803**System capability**: SystemCapability.Telephony.CoreService 2804 2805**Parameters** 2806 2807| Name | Type | Mandatory| Description | 2808| -------- | ----------------------- | ---- | ------------------------------------- | 2809| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 2810| callback | AsyncCallback\<string\> | Yes | Callback used to return the result. Baseband version of the device. | 2811 2812**Error codes** 2813 2814For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 2815 2816| ID| Error Message | 2817| -------- | -------------------------------------------- | 2818| 201 | Permission denied. | 2819| 202 | Non-system applications use system APIs. | 2820| 401 | Parameter error. | 2821| 8300001 | Invalid parameter value. | 2822| 8300002 | Operation failed. Cannot connect to service. | 2823| 8300003 | System internal error. | 2824| 8300999 | Unknown error code. | 2825 2826**Example** 2827 2828```ts 2829import { BusinessError } from '@ohos.base'; 2830 2831let slotId: number = 0; 2832radio.getBasebandVersion(slotId, (err: BusinessError, data: string) => { 2833 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 2834}); 2835``` 2836 2837 2838## radio.getBasebandVersion<sup>10+</sup> 2839 2840getBasebandVersion\(slotId: number\): Promise\<string\> 2841 2842Obtains the device baseband version of the SIM card in the specified slot. This API uses a promise to return the result. 2843 2844**System API**: This is a system API. 2845 2846**Required permission**: ohos.permission.GET_TELEPHONY_STATE 2847 2848**System capability**: SystemCapability.Telephony.CoreService 2849 2850**Parameters** 2851 2852| Name | Type | Mandatory| Description | 2853| -------- | ----------------------- | ---- | ------------------------------------- | 2854| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 2855 2856**Return value** 2857 2858| Type | Description | 2859| ----------------- | -------------------------------------- | 2860| Promise\<string\> | Promise used to return the result. | 2861 2862**Error codes** 2863 2864For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 2865 2866| ID| Error Message | 2867| -------- | -------------------------------------------- | 2868| 201 | Permission denied. | 2869| 202 | Non-system applications use system APIs. | 2870| 401 | Parameter error. | 2871| 8300001 | Invalid parameter value. | 2872| 8300002 | Operation failed. Cannot connect to service. | 2873| 8300003 | System internal error. | 2874| 8300999 | Unknown error code. | 2875 2876**Example** 2877 2878```ts 2879import { BusinessError } from '@ohos.base'; 2880 2881let slotId: number = 0; 2882radio.getBasebandVersion(slotId).then((data: string) => { 2883 console.log(`getBasebandVersion success, promise: data->${JSON.stringify(data)}`); 2884}).catch((err: BusinessError) => { 2885 console.error(`getBasebandVersion failed, promise: err->${JSON.stringify(err)}`); 2886}); 2887``` 2888 2889 2890## radio.setNROptionMode<sup>10+</sup> 2891 2892setNROptionMode\(slotId: number, mode: NROptionMode, callback: AsyncCallback\<void\>\): void 2893 2894Sets the NR mode of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. 2895 2896**System API**: This is a system API. 2897 2898**Required permission**: ohos.permission.SET_TELEPHONY_STATE 2899 2900**System capability**: SystemCapability.Telephony.CoreService 2901 2902**Parameters** 2903 2904| Name | Type | Mandatory| Description | 2905| -------- | ------------------------------------------------ | ---- | -------------------------------------- | 2906| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 | 2907| mode | [NROptionMode](#nroptionmode10) | Yes | Enumerates NR selection modes. | 2908| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. | 2909 2910**Error codes** 2911 2912For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 2913 2914| ID| Error Message | 2915| -------- | -------------------------------------------- | 2916| 201 | Permission denied. | 2917| 202 | Non-system applications use system APIs. | 2918| 401 | Parameter error. | 2919| 8300001 | Invalid parameter value. | 2920| 8300002 | Operation failed. Cannot connect to service. | 2921| 8300003 | System internal error. | 2922| 8300999 | Unknown error code. | 2923 2924**Example** 2925 2926```ts 2927import { BusinessError } from '@ohos.base'; 2928 2929let slotId: number = 0; 2930let mode: radio.NROptionMode = radio.NROptionMode.NR_OPTION_NSA_ONLY; 2931radio.setNROptionMode(slotId, mode, (err: BusinessError) => { 2932 console.log(`callback: err->${JSON.stringify(err)}`); 2933}); 2934``` 2935 2936 2937## radio.setNROptionMode<sup>10+</sup> 2938 2939setNROptionMode\(slotId: number, mode: NROptionMode\): Promise\<void\> 2940 2941Sets the NR mode of the SIM card in the specified slot. This API uses a promise to return the result. 2942 2943**System API**: This is a system API. 2944 2945**Required permission**: ohos.permission.SET_TELEPHONY_STATE 2946 2947**System capability**: SystemCapability.Telephony.CoreService 2948 2949**Parameters** 2950 2951| Name| Type | Mandatory| Description | 2952| ------ | ------------------------------- | ---- | ------------------------------------- | 2953| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 2954| mode | [NROptionMode](#nroptionmode10) | Yes | Enumerates NR selection modes. | 2955 2956**Return value** 2957 2958| Type | Description | 2959| ----------------- | ----------------------- | 2960| Promise\<void\> | Promise used to return the result. | 2961 2962**Error codes** 2963 2964For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 2965 2966| ID| Error Message | 2967| -------- | -------------------------------------------- | 2968| 201 | Permission denied. | 2969| 202 | Non-system applications use system APIs. | 2970| 401 | Parameter error. | 2971| 8300001 | Invalid parameter value. | 2972| 8300002 | Operation failed. Cannot connect to service. | 2973| 8300003 | System internal error. | 2974| 8300999 | Unknown error code. | 2975 2976**Example** 2977 2978```ts 2979import { BusinessError } from '@ohos.base'; 2980 2981let slotId: number = 0; 2982let mode: radio.NROptionMode = radio.NROptionMode.NR_OPTION_NSA_ONLY; 2983radio.setNROptionMode(slotId, mode).then(() => { 2984 console.log(`setNROptionMode success`); 2985}).catch((err: BusinessError) => { 2986 console.error(`setNROptionMode failed, promise: err->${JSON.stringify(err)}`); 2987}); 2988``` 2989 2990 2991## radio.getNROptionMode<sup>10+</sup> 2992 2993getNROptionMode\(slotId: number, callback: AsyncCallback\<NROptionMode\>\): void 2994 2995Obtains the NR option mode of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. 2996 2997**System API**: This is a system API. 2998 2999**System capability**: SystemCapability.Telephony.CoreService 3000 3001**Parameters** 3002 3003| Name | Type | Mandatory| Description | 3004| -------- | ------------------------------------------------ | ---- | -------------------------------------- | 3005| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 | 3006| callback | AsyncCallback\<[NROptionMode](#nroptionmode10)\> | Yes | Callback used to return the result. | 3007 3008**Error codes** 3009 3010For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 3011 3012| ID| Error Message | 3013| -------- | -------------------------------------------- | 3014| 202 | Non-system applications use system APIs. | 3015| 401 | Parameter error. | 3016| 8300001 | Invalid parameter value. | 3017| 8300002 | Operation failed. Cannot connect to service. | 3018| 8300003 | System internal error. | 3019| 8300999 | Unknown error code. | 3020 3021**Example** 3022 3023```ts 3024import { BusinessError } from '@ohos.base'; 3025 3026let slotId: number = 0; 3027radio.getNROptionMode(slotId, (err: BusinessError, data: radio.NROptionMode) => { 3028 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 3029}); 3030``` 3031 3032## radio.getNROptionMode<sup>10+</sup> 3033 3034getNROptionMode\(slotId: number\): Promise\<NROptionMode\> 3035 3036Obtains the NR option mode of the SIM card in the specified slot. This API uses a promise to return the result. 3037 3038**System API**: This is a system API. 3039 3040**System capability**: SystemCapability.Telephony.CoreService 3041 3042**Parameters** 3043 3044| Name| Type | Mandatory| Description | 3045| ------ | ------ | ---- | ------------------------------------- | 3046| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 3047 3048**Return value** 3049 3050| Type | Description | 3051| ----------------------------------------- | ----------------------- | 3052| Promise\<[NROptionMode](#nroptionmode10)\> | Promise used to return the result.| 3053 3054**Error codes** 3055 3056For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 3057 3058| ID| Error Message | 3059| -------- | -------------------------------------------- | 3060| 202 | Non-system applications use system APIs. | 3061| 401 | Parameter error. | 3062| 8300001 | Invalid parameter value. | 3063| 8300002 | Operation failed. Cannot connect to service. | 3064| 8300003 | System internal error. | 3065| 8300999 | Unknown error code. | 3066 3067**Example** 3068 3069```ts 3070import { BusinessError } from '@ohos.base'; 3071 3072let slotId: number = 0; 3073radio.getNROptionMode(slotId).then((data: radio.NROptionMode) => { 3074 console.log(`getNROptionMode success, promise: data->${JSON.stringify(data)}`); 3075}).catch((err: BusinessError) => { 3076 console.error(`getNROptionMode failed, promise: err->${JSON.stringify(err)}`); 3077}); 3078``` 3079 3080 3081## radio.getNetworkCapability<sup>10+</sup> 3082 3083getNetworkCapability\(slotId: number, type: NetworkCapabilityType, callback: AsyncCallback\<NetworkCapabilityState\>\): void 3084 3085Obtains the network capability of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. 3086 3087**System API**: This is a system API. 3088 3089**Required permission**: ohos.permission.GET_TELEPHONY_STATE 3090 3091**System capability**: SystemCapability.Telephony.CoreService 3092 3093**Parameters** 3094 3095| Name | Type | Mandatory| Description | 3096| -------- | -----------------------------------------------------------------------| ---- | ----------------------------------- | 3097| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 3098| type | [NetworkCapabilityType](#networkcapabilitytype10) | Yes | Network capability type. | 3099| callback | AsyncCallback\<[NetworkCapabilityState](#networkcapabilitystate10)\> | Yes | Callback used to return the result. | 3100 3101**Error codes** 3102 3103For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 3104 3105| ID| Error Message | 3106| -------- | -------------------------------------------- | 3107| 201 | Permission denied. | 3108| 202 | Non-system applications use system APIs. | 3109| 401 | Parameter error. | 3110| 8300001 | Invalid parameter value. | 3111| 8300002 | Operation failed. Cannot connect to service. | 3112| 8300003 | System internal error. | 3113| 8300999 | Unknown error code. | 3114 3115**Example** 3116 3117```ts 3118import { BusinessError } from '@ohos.base'; 3119 3120let slotId: number = 0; 3121let type: radio.NetworkCapabilityType = radio.NetworkCapabilityType.SERVICE_TYPE_NR; 3122radio.getNetworkCapability(slotId, type, (err: BusinessError, data: radio.NetworkCapabilityState) => { 3123 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 3124}); 3125``` 3126 3127 3128## radio.getNetworkCapability<sup>10+</sup> 3129 3130getNetworkCapability\(slotId: number, type: NetworkCapabilityType\): Promise\<NetworkCapabilityState\> 3131 3132Obtains the network capability of the SIM card in the specified slot. This API uses a promise to return the result. 3133 3134**System API**: This is a system API. 3135 3136**Required permission**: ohos.permission.GET_TELEPHONY_STATE 3137 3138**System capability**: SystemCapability.Telephony.CoreService 3139 3140**Parameters** 3141 3142| Name | Type | Mandatory| Description | 3143| -------- | --------------------------------------------------------------- | ---- | -------------------------------------- | 3144| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 3145| type | [NetworkCapabilityType](#networkcapabilitytype10) | Yes | Network capability type. | 3146 3147**Return value** 3148 3149| Type | Description | 3150| ------------------------------------------------------------- | ----------------------- | 3151| Promise\<[NetworkCapabilityState](#networkcapabilitystate10)\> | Promise used to return the result.| 3152 3153**Error codes** 3154 3155For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 3156 3157| ID| Error Message | 3158| -------- | -------------------------------------------- | 3159| 201 | Permission denied. | 3160| 202 | Non-system applications use system APIs. | 3161| 401 | Parameter error. | 3162| 8300001 | Invalid parameter value. | 3163| 8300002 | Operation failed. Cannot connect to service. | 3164| 8300003 | System internal error. | 3165| 8300999 | Unknown error code. | 3166 3167**Example** 3168 3169```ts 3170import { BusinessError } from '@ohos.base'; 3171 3172let slotId: number = 0; 3173let type: radio.NetworkCapabilityType = radio.NetworkCapabilityType.SERVICE_TYPE_NR; 3174radio.getNetworkCapability(slotId, type).then((data: radio.NetworkCapabilityState) => { 3175 console.log(`getNetworkCapability success, promise: data->${JSON.stringify(data)}`); 3176}).catch((err: BusinessError) => { 3177 console.log(`getNetworkCapability failed, promise: err->${JSON.stringify(err)}`); 3178}); 3179``` 3180 3181 3182## radio.setNetworkCapability<sup>10+</sup> 3183 3184setNetworkCapability\(slotId: number, type: NetworkCapabilityType, state: NetworkCapabilityState, 3185 callback: AsyncCallback\<void\>\): void 3186 3187Sets the network capability of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. 3188 3189**System API**: This is a system API. 3190 3191**Required permission**: ohos.permission.SET_TELEPHONY_STATE 3192 3193**System capability**: SystemCapability.Telephony.CoreService 3194 3195**Parameters** 3196 3197| Name | Type | Mandatory| Description | 3198| -------- | --------------------------------------------------------------- | ---- | -------------------------------------- | 3199| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 3200| type | [NetworkCapabilityType](#networkcapabilitytype10) | Yes | Network capability type. | 3201| state | [NetworkCapabilityState](#networkcapabilitystate10) | Yes | Network capability status. | 3202| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. | 3203 3204**Error codes** 3205 3206For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 3207 3208| ID| Error Message | 3209| -------- | -------------------------------------------- | 3210| 201 | Permission denied. | 3211| 202 | Non-system applications use system APIs. | 3212| 401 | Parameter error. | 3213| 8300001 | Invalid parameter value. | 3214| 8300002 | Operation failed. Cannot connect to service. | 3215| 8300003 | System internal error. | 3216| 8300999 | Unknown error code. | 3217 3218**Example** 3219 3220```ts 3221import { BusinessError } from '@ohos.base'; 3222 3223let slotId: number = 0; 3224let type: radio.NetworkCapabilityType = radio.NetworkCapabilityType.SERVICE_TYPE_NR; 3225let state: radio.NetworkCapabilityState = radio.NetworkCapabilityState.SERVICE_CAPABILITY_ON; 3226radio.setNetworkCapability(slotId, type, state, (err: BusinessError) => { 3227 console.log(`callback: err->${JSON.stringify(err)}`); 3228}); 3229``` 3230 3231 3232## radio.setNetworkCapability<sup>10+</sup> 3233 3234setNetworkCapability\(slotId: number, type: NetworkCapabilityType, state: NetworkCapabilityState\): Promise\<void\> 3235 3236Sets the network capability of the SIM card in the specified slot. This API uses a promise to return the result. 3237 3238**System API**: This is a system API. 3239 3240**Required permission**: ohos.permission.SET_TELEPHONY_STATE 3241 3242**System capability**: SystemCapability.Telephony.CoreService 3243 3244**Parameters** 3245 3246| Name | Type | Mandatory| Description | 3247| -------- | --------------------------------------------------------------- | ---- | -------------------------------------- | 3248| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 3249| type | [NetworkCapabilityType](#networkcapabilitytype10) | Yes | Network capability type. | 3250| state | [NetworkCapabilityState](#networkcapabilitystate10) | Yes | Network capability status. | 3251 3252**Return value** 3253 3254| Type | Description | 3255| --------------- | ----------------------- | 3256| Promise\<void\> | Promise used to return the result.| 3257 3258**Error codes** 3259 3260For details about the error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 3261 3262| ID| Error Message | 3263| -------- | -------------------------------------------- | 3264| 201 | Permission denied. | 3265| 202 | Non-system applications use system APIs. | 3266| 401 | Parameter error. | 3267| 8300001 | Invalid parameter value. | 3268| 8300002 | Operation failed. Cannot connect to service. | 3269| 8300003 | System internal error. | 3270| 8300999 | Unknown error code. | 3271 3272**Example** 3273 3274```ts 3275import { BusinessError } from '@ohos.base'; 3276 3277let slotId: number = 0; 3278let type: radio.NetworkCapabilityType = radio.NetworkCapabilityType.SERVICE_TYPE_NR; 3279let state: radio.NetworkCapabilityState = radio.NetworkCapabilityState.SERVICE_CAPABILITY_ON; 3280radio.setNetworkCapability(slotId, type, state).then(() => { 3281 console.log(`setNetworkCapability success`); 3282}).catch((err: BusinessError) => { 3283 console.log(`setNetworkCapability failed, promise: err->${JSON.stringify(err)}`); 3284}); 3285``` 3286 3287 3288## RadioTechnology 3289 3290Enumerates radio access technologies. 3291 3292**System capability**: SystemCapability.Telephony.CoreService 3293 3294| Name | Value | Description | 3295| ------------------------- | ---- | ------------------------------------------------------------ | 3296| RADIO_TECHNOLOGY_UNKNOWN | 0 | Unknown RAT | 3297| RADIO_TECHNOLOGY_GSM | 1 | Global System for Mobile Communication (GSM) | 3298| RADIO_TECHNOLOGY_1XRTT | 2 | Single-Carrier Radio Transmission Technology (1XRTT)| 3299| RADIO_TECHNOLOGY_WCDMA | 3 | Wideband Code Division Multiple Access (WCDMA)| 3300| RADIO_TECHNOLOGY_HSPA | 4 | High Speed Packet Access (HSPA) | 3301| RADIO_TECHNOLOGY_HSPAP | 5 | Evolved High Speed Packet Access (HSPA+) | 3302| RADIO_TECHNOLOGY_TD_SCDMA | 6 | Time Division Synchronous Code Division Multiple Access (TD-SCDMA)| 3303| RADIO_TECHNOLOGY_EVDO | 7 | Evolution-Data Optimized (EVDO) | 3304| RADIO_TECHNOLOGY_EHRPD | 8 | Evolved High Rate Package Data (EHRPD) | 3305| RADIO_TECHNOLOGY_LTE | 9 | Long Term Evolution (LTE) | 3306| RADIO_TECHNOLOGY_LTE_CA | 10 | Long Term Evolution_Carrier Aggregation (LTE_CA)| 3307| RADIO_TECHNOLOGY_IWLAN | 11 | Industrial Wireless LAN (IWLAN) | 3308| RADIO_TECHNOLOGY_NR | 12 | New Radio (NR) | 3309 3310 3311## SignalInformation 3312 3313Defines the signal strength. 3314 3315**System capability**: SystemCapability.Telephony.CoreService 3316 3317| Name | Type | Mandatory| Description | 3318| --------------- | --------------------------- | ---- | ------------------ | 3319| signalType | [NetworkType](#networktype) | Yes | Signal strength type.| 3320| signalLevel | number | Yes | Signal strength level.| 3321| dBm<sup>9+</sup>| number | Yes | Signal strength, in dBm. | 3322 3323## NetworkType 3324 3325Enumerates network types. 3326 3327**System capability**: SystemCapability.Telephony.CoreService 3328 3329| Name | Value | Description | 3330| -------------------- | ---- | ------------------------------------------------------------ | 3331| NETWORK_TYPE_UNKNOWN | 0 | Unknown network. | 3332| NETWORK_TYPE_GSM | 1 | GSM network. | 3333| NETWORK_TYPE_CDMA | 2 | CDMA network. | 3334| NETWORK_TYPE_WCDMA | 3 | WCDMA network. | 3335| NETWORK_TYPE_TDSCDMA | 4 | TD-SCDMA network.| 3336| NETWORK_TYPE_LTE | 5 | LTE network. | 3337| NETWORK_TYPE_NR | 6 | 5G NR network. | 3338 3339## NetworkState 3340 3341Defines the network status. 3342 3343**System capability**: SystemCapability.Telephony.CoreService 3344 3345| Name | Type | Mandatory| Description | 3346| -------------------- | ----------------------------------- | ---- | ------------------------------------------------------------ | 3347| longOperatorName | string | Yes | Long carrier name of the registered network. | 3348| shortOperatorName | string | Yes | Short carrier name of the registered network. | 3349| plmnNumeric | string | Yes | PLMN code of the registered network. | 3350| isRoaming | boolean | Yes | Whether the user is roaming. | 3351| regState | [RegState](#regstate) | Yes | Network registration status of the device. | 3352| cfgTech<sup>8+</sup> | [RadioTechnology](#radiotechnology) | Yes | RAT of the device. | 3353| nsaState | [NsaState](#nsastate) | Yes | NSA network registration status of the device. | 3354| isCaActive | boolean | Yes | CA status. | 3355| isEmergency | boolean | Yes | Whether only emergency calls are allowed. | 3356 3357 3358## RegState 3359 3360Defines the network registration status of the device. 3361 3362**System capability**: SystemCapability.Telephony.CoreService 3363 3364| Name | Value | Description | 3365| ----------------------------- | ---- | -------------------------- | 3366| REG_STATE_NO_SERVICE | 0 | The device cannot use any services, including data, SMS, and call services. | 3367| REG_STATE_IN_SERVICE | 1 | The device can use services properly, including data, SMS, and call services. | 3368| REG_STATE_EMERGENCY_CALL_ONLY | 2 | The device can use only the emergency call service.| 3369| REG_STATE_POWER_OFF | 3 | The device cannot communicate with the network because the cellular radio service is disabled or the modem is powered off. | 3370 3371 3372## NsaState 3373 3374Enumerates NSA network states. 3375 3376**System capability**: SystemCapability.Telephony.CoreService 3377 3378| Name | Value | Description | 3379| -------------------------- | ---- | ---------------------------------------------------------- | 3380| NSA_STATE_NOT_SUPPORT | 1 | The device is in idle or connected state in an LTE cell that does not support NSA. | 3381| NSA_STATE_NO_DETECT | 2 | The device is in the idle state in an LTE cell that supports NSA but not NR coverage detection.| 3382| NSA_STATE_CONNECTED_DETECT | 3 | The device is connected to the LTE network in an LTE cell that supports NSA and NR coverage detection. | 3383| NSA_STATE_IDLE_DETECT | 4 | The device is in the idle state in an LTE cell that supports NSA and NR coverage detection. | 3384| NSA_STATE_DUAL_CONNECTED | 5 | The device is connected to the LTE/NR network in an LTE cell that supports NSA. | 3385| NSA_STATE_SA_ATTACHED | 6 | The device is idle or connected to the NG-RAN cell when being attached to the 5G Core. | 3386 3387 3388## NetworkSelectionMode 3389 3390Enumerates network selection modes. 3391 3392**System capability**: SystemCapability.Telephony.CoreService 3393 3394| Name | Value | Description | 3395| --------------------------- | ---- | -------------- | 3396| NETWORK_SELECTION_UNKNOWN | 0 | Unknown network selection mode.| 3397| NETWORK_SELECTION_AUTOMATIC | 1 | Automatic network selection mode.| 3398| NETWORK_SELECTION_MANUAL | 2 | Manual network selection mode.| 3399 3400## PreferredNetworkMode<sup>8+</sup> 3401 3402Enumerates preferred network modes. 3403 3404**System API**: This is a system API. 3405 3406**System capability**: SystemCapability.Telephony.CoreService 3407 3408| Name | Value | Description | 3409| --------------------------------------------------------- | ---- | --------------------------------------------- | 3410| PREFERRED_NETWORK_MODE_GSM | 1 | GSM network mode. | 3411| PREFERRED_NETWORK_MODE_WCDMA | 2 | WCDMA network mode. | 3412| PREFERRED_NETWORK_MODE_LTE | 3 | LTE network mode. | 3413| PREFERRED_NETWORK_MODE_LTE_WCDMA | 4 | LTE+WCDMA network mode. | 3414| PREFERRED_NETWORK_MODE_LTE_WCDMA_GSM | 5 | LTE+WCDMA+GSM network mode. | 3415| PREFERRED_NETWORK_MODE_WCDMA_GSM | 6 | WCDMA+GSM network mode. | 3416| PREFERRED_NETWORK_MODE_CDMA | 7 | CDMA network mode. | 3417| PREFERRED_NETWORK_MODE_EVDO | 8 | EVDO network mode. | 3418| PREFERRED_NETWORK_MODE_EVDO_CDMA | 9 | EVDO+CDMA network mode. | 3419| PREFERRED_NETWORK_MODE_WCDMA_GSM_EVDO_CDMA | 10 | WCDMA+GSM+EVDO+CDMA network mode. | 3420| PREFERRED_NETWORK_MODE_LTE_EVDO_CDMA | 11 | LTE+EVDO+CDMA network mode. | 3421| PREFERRED_NETWORK_MODE_LTE_WCDMA_GSM_EVDO_CDMA | 12 | LTE+WCDMA+GSM+EVDO+CDMA network mode. | 3422| PREFERRED_NETWORK_MODE_TDSCDMA | 13 | TD-SCDMA network mode. | 3423| PREFERRED_NETWORK_MODE_TDSCDMA_GSM | 14 | TD-SCDMA+GSM network mode. | 3424| PREFERRED_NETWORK_MODE_TDSCDMA_WCDMA | 15 | TD-SCDMA+WCDMA network mode. | 3425| PREFERRED_NETWORK_MODE_TDSCDMA_WCDMA_GSM | 16 | TD-SCDMA+WCDMA+GSM network mode. | 3426| PREFERRED_NETWORK_MODE_LTE_TDSCDMA | 17 | LTE+TD-SCDMA network mode. | 3427| PREFERRED_NETWORK_MODE_LTE_TDSCDMA_GSM | 18 | LTE+TD-SCDMA+GSM network mode. | 3428| PREFERRED_NETWORK_MODE_LTE_TDSCDMA_WCDMA | 19 | LTE+TD-SCDMA+WCDMA network mode. | 3429| PREFERRED_NETWORK_MODE_LTE_TDSCDMA_WCDMA_GSM | 20 | LTE+TD-SCDMA+WCDMA+GSM network mode. | 3430| PREFERRED_NETWORK_MODE_TDSCDMA_WCDMA_GSM_EVDO_CDMA | 21 | TD-SCDMA+WCDMA+GSM+EVDO+CDMA network mode. | 3431| PREFERRED_NETWORK_MODE_LTE_TDSCDMA_WCDMA_GSM_EVDO_CDMA | 22 | LTE+TD-SCDMA+WCDMA+GSM+EVDO+CDMA network mode.| 3432| PREFERRED_NETWORK_MODE_NR | 31 | NR network mode. | 3433| PREFERRED_NETWORK_MODE_NR_LTE | 32 | NR+LTE network mode. | 3434| PREFERRED_NETWORK_MODE_NR_LTE_WCDMA | 33 | NR+LTE+WCDMA network mode. | 3435| PREFERRED_NETWORK_MODE_NR_LTE_WCDMA_GSM | 34 | NR+LTE+WCDMA+GSM network mode. | 3436| PREFERRED_NETWORK_MODE_NR_LTE_EVDO_CDMA | 35 | NR+LTE+EVDO+CDMA network mode. | 3437| PREFERRED_NETWORK_MODE_NR_LTE_WCDMA_GSM_EVDO_CDMA | 36 | NR+LTE+WCDMA+GSM+EVDO+CDMA network mode. | 3438| PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA | 37 | NR+LTE+TD-SCDMA network mode. | 3439| PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_GSM | 38 | NR+LTE+TD-SCDMA+GSM network mode. | 3440| PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA | 39 | NR+LTE+TD-SCDMA+WCDMA network mode. | 3441| PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA_GSM | 40 | NR+LTE+TD-SCDMA+WCDMA+GSM network mode. | 3442| PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA_GSM_EVDO_CDMA | 41 | NR+LTE+TD-SCDMA+WCDMA+GSM network mode. | 3443| PREFERRED_NETWORK_MODE_MAX_VALUE | 99 | Maximum value of the preferred network mode. | 3444 3445## CellInformation<sup>8+</sup> 3446 3447Defines the cell information. 3448 3449**System capability**: SystemCapability.Telephony.CoreService 3450 3451| Name | Type | Mandatory| Description | 3452| ----------------- | --------------------------------------- | ---- | ------------------------------------------------------------ | 3453| networkType | [NetworkType](#networktype) | Yes | Network type of the cell. | 3454| isCamped | boolean | Yes | Cell status.<br>**System API**: This is a system API. | 3455| timeStamp | number | Yes | Timestamp when cell information is obtained.<br>**System API**: This is a system API. | 3456| signalInformation | [SignalInformation](#signalinformation) | Yes | Signal information. | 3457| data | [CdmaCellInformation](#cdmacellinformation8) \| [GsmCellInformation](#gsmcellinformation8) \| [LteCellInformation](#ltecellinformation8) \| [NrCellInformation](#nrcellinformation8) \| [TdscdmaCellInformation](#tdscdmacellinformation8) | Yes | CDMA cell information\|GSM cell information\|LTE cell information\|NR cell information\|TD-SCDMA cell information<br>**System API**: This is a system API.| 3458 3459## CdmaCellInformation<sup>8+</sup> 3460 3461Defines the CDMA cell information. 3462 3463**System API**: This is a system API. 3464 3465**System capability**: SystemCapability.Telephony.CoreService 3466 3467| Name | Type | Mandatory| Description | 3468| --------- | ------ | ---- | ------------ | 3469| baseId | number | Yes | Base station ID. | 3470| latitude | number | Yes | Longitude. | 3471| longitude | number | Yes | Latitude. | 3472| nid | number | Yes | Network ID.| 3473| sid | number | Yes | System ID.| 3474 3475## GsmCellInformation<sup>8+</sup> 3476 3477Defines the GSM cell information. 3478 3479**System API**: This is a system API. 3480 3481**System capability**: SystemCapability.Telephony.CoreService 3482 3483| Name | Type | Mandatory| Description | 3484| ------ | ------ | ---- | -------------------- | 3485| lac | number | Yes | Location area code. | 3486| cellId | number | Yes | Cell ID. | 3487| arfcn | number | Yes | Absolute radio frequency channel number.| 3488| bsic | number | Yes | Base station ID. | 3489| mcc | string | Yes | Mobile country code. | 3490| mnc | string | Yes | Mobile network code. | 3491 3492## LteCellInformation<sup>8+</sup> 3493 3494LTE cell information. 3495 3496**System API**: This is a system API. 3497 3498**System capability**: SystemCapability.Telephony.CoreService 3499 3500| Name | Type | Mandatory| Description | 3501| ------------- | ------- | ---- | ----------------------- | 3502| cgi | number | Yes | Cell global identification. | 3503| pci | number | Yes | Physical cell ID. | 3504| tac | number | Yes | Tracking area code. | 3505| earfcn | number | Yes | Absolute radio frequency channel number. | 3506| bandwidth | number | Yes | Bandwidth. | 3507| mcc | string | Yes | Mobile country code. | 3508| mnc | string | Yes | Mobile network code. | 3509| isSupportEndc | boolean | Yes | Support for New Radio_Dual Connectivity.| 3510 3511## NrCellInformation<sup>8+</sup> 3512 3513Defines the 5G NR cell information. 3514 3515**System API**: This is a system API. 3516 3517**System capability**: SystemCapability.Telephony.CoreService 3518 3519| Name | Type | Mandatory| Description | 3520| ------- | ------ | ---- | ---------------- | 3521| nrArfcn | number | Yes | 5G frequency number. | 3522| pci | number | Yes | Physical cell ID. | 3523| tac | number | Yes | Tracking area code. | 3524| nci | number | Yes | 5G network cell ID.| 3525| mcc | string | Yes | Mobile country code. | 3526| mnc | string | Yes | Mobile network code. | 3527 3528## TdscdmaCellInformation<sup>8+</sup> 3529 3530Defines the TD-SCDMA cell information. 3531 3532**System API**: This is a system API. 3533 3534**System capability**: SystemCapability.Telephony.CoreService 3535 3536| Name | Type | Mandatory| Description | 3537| ------ | ------ | ---- | ------------ | 3538| lac | number | Yes | Location area code.| 3539| cellId | number | Yes | Cell ID. | 3540| cpid | number | Yes | Cell parameter ID.| 3541| uarfcn | number | Yes | Absolute radio frequency number.| 3542| mcc | string | Yes | Mobile country code.| 3543| mnc | string | Yes | Mobile network code. | 3544 3545## WcdmaCellInformation<sup>8+</sup> 3546 3547Defines the WCDMA cell information. 3548 3549**System API**: This is a system API. 3550 3551**System capability**: SystemCapability.Telephony.CoreService 3552 3553| Name | Type | Mandatory| Description | 3554| ------ | ------ | ---- | ------------ | 3555| lac | number | Yes | Location area code.| 3556| cellId | number | Yes | Cell ID. | 3557| psc | number | Yes | Primary scrambling code. | 3558| uarfcn | number | Yes | Absolute radio frequency number.| 3559| mcc | string | Yes | Mobile country code.| 3560| mnc | string | Yes | Mobile network code. | 3561 3562## NrOptionMode<sup>(deprecated)</sup> 3563 3564Enumerates NR selection modes. 3565 3566> **NOTE** 3567> 3568> This API is supported since API version 8 and deprecated since API version 10. You are advised to use [NROptionMode](#nroptionmode10). 3569 3570**System API**: This is a system API. 3571 3572**System capability**: SystemCapability.Telephony.CoreService 3573 3574| Name | Value | Description | 3575| -------------------- | ---- | ---------------------------------- | 3576| NR_OPTION_UNKNOWN | 0 | Unknown NR selection mode. | 3577| NR_OPTION_NSA_ONLY | 1 | NR selection mode in 5G non-standalone networking. | 3578| NR_OPTION_SA_ONLY | 2 | NR selection mode in 5G non-standalone networking. | 3579| NR_OPTION_NSA_AND_SA | 3 | NR selection mode in non-standalone and standalone networking.| 3580 3581## NROptionMode<sup>10+</sup> 3582 3583Enumerates NR selection modes. 3584 3585**System API**: This is a system API. 3586 3587**System capability**: SystemCapability.Telephony.CoreService 3588 3589| Name | Value | Description | 3590| -------------------- | ---- | --------------------------------- | 3591| NR_OPTION_UNKNOWN | 0 | Unknown NR selection mode. | 3592| NR_OPTION_NSA_ONLY | 1 | NR selection mode in 5G non-standalone networking. | 3593| NR_OPTION_SA_ONLY | 2 | NR selection mode in 5G non-standalone networking. | 3594| NR_OPTION_NSA_AND_SA | 3 | NR selection mode in non-standalone and standalone networking. | 3595 3596## NetworkSearchResult 3597 3598Defines the network search result. 3599 3600**System API**: This is a system API. 3601 3602**System capability**: SystemCapability.Telephony.CoreService 3603 3604| Name | Type | Mandatory| Description | 3605| ---------------------- | ------------------------------------------------- | ---- | -------------- | 3606| isNetworkSearchSuccess | boolean | Yes | Successful network search.| 3607| networkSearchResult | Array<[NetworkInformation](#networkinformation)\> | Yes | Network search result.| 3608 3609## NetworkInformation 3610 3611Defines the network information. 3612 3613**System API**: This is a system API. 3614 3615**System capability**: SystemCapability.Telephony.CoreService 3616 3617| Name | Type | Mandatory| Description | 3618| --------------- | --------------------------------------------------- | ---- | -------------- | 3619| operatorName | string | Yes | Carrier name.| 3620| operatorNumeric | string | Yes | Carrier number. | 3621| state | [NetworkInformationState](#networkinformationstate) | Yes | Network information status.| 3622| radioTech | string | Yes | Radio access technology. | 3623 3624## NetworkInformationState 3625 3626Enumerates network information states. 3627 3628**System API**: This is a system API. 3629 3630**System capability**: SystemCapability.Telephony.CoreService 3631 3632| Name | Value | Description | 3633| ----------------- | ---- | ---------------- | 3634| NETWORK_UNKNOWN | 0 | Unknown state. | 3635| NETWORK_AVAILABLE | 1 | Available for registration.| 3636| NETWORK_CURRENT | 2 | Registered state.| 3637| NETWORK_FORBIDDEN | 3 | Unavailable for registration. | 3638 3639## NetworkSelectionModeOptions 3640 3641Defines the network selection mode. 3642 3643**System API**: This is a system API. 3644 3645**System capability**: SystemCapability.Telephony.CoreService 3646 3647| Name | Type | Mandatory| Description | 3648| ------------------ | --------------------------------------------- | ---- | -------------------------------------- | 3649| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 3650| selectMode | [NetworkSelectionMode](#networkselectionmode) | Yes | Network selection mode. | 3651| networkInformation | [NetworkInformation](#networkinformation) | Yes | Network information. | 3652| resumeSelection | boolean | Yes | Whether to resume selection. | 3653 3654## ImsRegState<sup>9+</sup> 3655 3656Enumerates IMS registration states. 3657 3658**System API**: This is a system API. 3659 3660**System capability**: SystemCapability.Telephony.CoreService 3661 3662| Name | Value | Description | 3663| ---------------- | ---- | -------- | 3664| IMS_UNREGISTERED | 0 | Not registered.| 3665| IMS_REGISTERED | 1 | Registered.| 3666 3667## ImsRegTech<sup>9+</sup> 3668 3669Enumerates IMS registration technologies. 3670 3671**System API**: This is a system API. 3672 3673**System capability**: SystemCapability.Telephony.CoreService 3674 3675| Name | Value | Description | 3676| ----------------------- | ---- | --------------- | 3677| REGISTRATION_TECH_NONE | 0 | None. | 3678| REGISTRATION_TECH_LTE | 1 | LTE. | 3679| REGISTRATION_TECH_IWLAN | 2 | I-WLAN.| 3680| REGISTRATION_TECH_NR | 3 | NR. | 3681 3682## ImsRegInfo<sup>9+</sup> 3683 3684Defines the IMS registration information. 3685 3686**System API**: This is a system API. 3687 3688**System capability**: SystemCapability.Telephony.CoreService 3689 3690| Name | Type | Mandatory| Description | 3691| ----------- | ---------------------------- | ---- | ------------- | 3692| imsRegState | [ImsRegState](#imsregstate9) | Yes | IMS registration state.| 3693| imsRegTech | [ImsRegTech](#imsregtech9) | Yes | IMS registration technology.| 3694 3695## ImsServiceType<sup>9+</sup> 3696 3697Enumerates IMS service types. 3698 3699**System API**: This is a system API. 3700 3701**System capability**: SystemCapability.Telephony.CoreService 3702 3703| Name | Value | Description | 3704| ---------- | ---- | ---------- | 3705| TYPE_VOICE | 0 | Voice service.| 3706| TYPE_VIDEO | 1 | Video service.| 3707| TYPE_UT | 2 | UT service. | 3708| TYPE_SMS | 3 | SMS service.| 3709 3710## NetworkCapabilityType<sup>10+</sup> 3711 3712Enumerates network capability types. 3713 3714**System API**: This is a system API. 3715 3716**System capability**: SystemCapability.Telephony.CoreService 3717 3718| Name | Value | Description | 3719| -----------------| ---- | ---------- | 3720| SERVICE_TYPE_LTE | 0 | LTE service.| 3721| SERVICE_TYPE_NR | 1 | NR service.| 3722 3723## NetworkCapabilityState<sup>10+</sup> 3724 3725Defines the network capability switch status. 3726 3727**System API**: This is a system API. 3728 3729**System capability**: SystemCapability.Telephony.CoreService 3730 3731| Name | Value | Description | 3732| -----------------------| ---- | ---------- | 3733| SERVICE_CAPABILITY_OFF | 0 | The network capability is disabled.| 3734| SERVICE_CAPABILITY_ON | 1 | The network capability is enabled.| 3735