1# @ohos.telephony.radio (Network Search) 2 3The **radio** module provides basic network search management functions. Using the APIs provided by this module, 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 for the SIM card in the specified slot, and carrier name. Besides, you can check whether the current device supports New Radio \(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 '@kit.TelephonyKit'; 14``` 15 16## radio.getRadioTech 17 18getRadioTech\(slotId: number, callback: AsyncCallback<[NetworkRadioTech](#networkradiotech11)\>\): 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\<[NetworkRadioTech](#networkradiotech11)\> | Yes | Callback used to return the result. | 32 33**Error codes** 34 35For details about the error codes, see[ohos.telephony (Telephony) Error Codes](errorcode-telephony.md). 36 37| ID| Error Message | 38| -------- | -------------------------------------------- | 39| 201 | Permission denied. | 40| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 41| 8300001 | Invalid parameter value. | 42| 8300002 | Service connection failed. | 43| 8300003 | System internal error. | 44| 8300999 | Unknown error. | 45 46**Example** 47 48```ts 49import { BusinessError } from '@kit.BasicServicesKit'; 50 51let slotId: number = 0; 52radio.getRadioTech(slotId, (err: BusinessError, data: radio.NetworkRadioTech) => { 53 if (err) { 54 console.error(`getRadioTech failed, callback: err->${JSON.stringify(err)}`); 55 return; 56 } 57 console.log(`getRadioTech success, callback: data->${JSON.stringify(data)}`); 58}); 59``` 60 61 62## radio.getRadioTech 63 64getRadioTech\(slotId: number\): Promise\<[NetworkRadioTech](#networkradiotech11)\> 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\<[NetworkRadioTech](#networkradiotech11)\> | Promise used to return the result.| 83 84**Error codes** 85 86For details about the error codes, see[ohos.telephony (Telephony) Error Codes](errorcode-telephony.md). 87 88| ID| Error Message | 89| -------- | -------------------------------------------- | 90| 201 | Permission denied. | 91| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 92| 8300001 | Invalid parameter value. | 93| 8300002 | Service connection failed. | 94| 8300003 | System internal error. | 95| 8300999 | Unknown error. | 96 97**Example** 98 99```ts 100import { BusinessError } from '@kit.BasicServicesKit'; 101 102let slotId: number = 0; 103radio.getRadioTech(slotId).then((data: radio.NetworkRadioTech) => { 104 console.log(`getRadioTech success, promise: data->${JSON.stringify(data)}`); 105}).catch((err: BusinessError) => { 106 console.error(`getRadioTech failed, promise: err->${JSON.stringify(err)}`); 107}); 108``` 109 110 111## radio.getNetworkState 112 113getNetworkState\(callback: AsyncCallback\<NetworkState\>\): void 114 115Obtains the network status. This API uses an asynchronous callback to return the result. 116 117**Required permission**: ohos.permission.GET_NETWORK_INFO 118 119**System capability**: SystemCapability.Telephony.CoreService 120 121**Parameters** 122 123| Name | Type | Mandatory| Description | 124| -------- | ---------------------------------------------- | ---- | ---------- | 125| callback | AsyncCallback\<[NetworkState](#networkstate)\> | Yes | Callback used to return the result. | 126 127**Error codes** 128 129For details about the error codes, see[ohos.telephony (Telephony) Error Codes](errorcode-telephony.md). 130 131| ID| Error Message | 132| -------- | -------------------------------------------- | 133| 201 | Permission denied. | 134| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 135| 8300001 | Invalid parameter value. | 136| 8300002 | Service connection failed. | 137| 8300003 | System internal error. | 138| 8300999 | Unknown error. | 139 140**Example** 141 142```ts 143import { BusinessError } from '@kit.BasicServicesKit'; 144 145radio.getNetworkState((err: BusinessError, data: radio.NetworkState) => { 146 if (err) { 147 console.error(`getNetworkState failed, callback: err->${JSON.stringify(err)}`); 148 return; 149 } 150 console.log(`getNetworkState success, callback: 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[ohos.telephony (Telephony) Error Codes](errorcode-telephony.md). 175 176| ID| Error Message | 177| -------- | -------------------------------------------- | 178| 201 | Permission denied. | 179| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 180| 8300001 | Invalid parameter value. | 181| 8300002 | Service connection failed. | 182| 8300003 | System internal error. | 183| 8300999 | Unknown error. | 184 185**Example** 186 187```ts 188import { BusinessError } from '@kit.BasicServicesKit'; 189 190let slotId: number = 0; 191radio.getNetworkState(slotId, (err: BusinessError, data: radio.NetworkState) => { 192 if (err) { 193 console.error(`getNetworkState failed, callback: err->${JSON.stringify(err)}`); 194 return; 195 } 196 console.log(`getNetworkState success, callback: data->${JSON.stringify(data)}`); 197}); 198``` 199 200 201## radio.getNetworkState 202 203getNetworkState\(slotId?: number\): Promise\<NetworkState\> 204 205Obtains the network status of the SIM card in the specified slot. This API uses a promise to return the result. 206 207**Required permission**: ohos.permission.GET_NETWORK_INFO 208 209**System capability**: SystemCapability.Telephony.CoreService 210 211**Parameters** 212 213| Name| Type | Mandatory| Description | 214| ------ | ------ | ---- | -------------------------------------- | 215| slotId | number | No | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 216 217**Return value** 218 219| Type | Description | 220| ---------------------------------------- | --------------------------- | 221| Promise\<[NetworkState](#networkstate)\> | Promise used to return the result.| 222 223**Error codes** 224 225For details about the error codes, see[ohos.telephony (Telephony) Error Codes](errorcode-telephony.md). 226 227| ID| Error Message | 228| -------- | -------------------------------------------- | 229| 201 | Permission denied. | 230| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 231| 8300001 | Invalid parameter value. | 232| 8300002 | Service connection failed. | 233| 8300003 | System internal error. | 234| 8300999 | Unknown error. | 235 236**Example** 237 238```ts 239import { BusinessError } from '@kit.BasicServicesKit'; 240 241let slotId: number = 0; 242radio.getNetworkState(slotId).then((data: radio.NetworkState) => { 243 console.log(`getNetworkState success, promise: data->${JSON.stringify(data)}`); 244}).catch((err: BusinessError) => { 245 console.error(`getNetworkState failed, promise: err->${JSON.stringify(err)}`); 246}); 247``` 248 249 250## radio.getNetworkSelectionMode 251 252getNetworkSelectionMode\(slotId: number, callback: AsyncCallback\<NetworkSelectionMode\>\): void 253 254Obtains the network selection mode of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. 255 256**System capability**: SystemCapability.Telephony.CoreService 257 258**Parameters** 259 260| Name | Type | Mandatory| Description | 261| -------- | ------------------------------------------------------------ | ---- | -------------------------------------- | 262| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 263| callback | AsyncCallback\<[NetworkSelectionMode](#networkselectionmode)\> | Yes | Callback used to return the result. | 264 265**Error codes** 266 267For details about the error codes, see[ohos.telephony (Telephony) Error Codes](errorcode-telephony.md). 268 269| ID| Error Message | 270| -------- | -------------------------------------------- | 271| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 272| 8300001 | Invalid parameter value. | 273| 8300002 | Service connection failed. | 274| 8300003 | System internal error. | 275| 8300999 | Unknown error. | 276 277**Example** 278 279```ts 280import { BusinessError } from '@kit.BasicServicesKit'; 281 282let slotId: number = 0; 283radio.getNetworkSelectionMode(slotId, (err: BusinessError, data: radio.NetworkSelectionMode) => { 284 if (err) { 285 console.error(`getNetworkSelectionMode failed, callback: err->${JSON.stringify(err)}`); 286 return; 287 } 288 console.log(`getNetworkSelectionMode success, callback: data->${JSON.stringify(data)}`); 289}); 290``` 291 292 293## radio.getNetworkSelectionMode 294 295getNetworkSelectionMode\(slotId: number\): Promise\<NetworkSelectionMode\> 296 297Obtains the network selection mode of the SIM card in the specified slot. This API uses a promise to return the result. 298 299**System capability**: SystemCapability.Telephony.CoreService 300 301**Parameters** 302 303| Name| Type | Mandatory| Description | 304| ------ | ------ | ---- | -------------------------------------- | 305| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 306 307**Return value** 308 309| Type | Description | 310| -------------------------------------------------------- | ------------------------------- | 311| Promise\<[NetworkSelectionMode](#networkselectionmode)\> | Promise used to return the result.| 312 313**Error codes** 314 315For details about the error codes, see[ohos.telephony (Telephony) Error Codes](errorcode-telephony.md). 316 317| ID| Error Message | 318| -------- | -------------------------------------------- | 319| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 320| 8300001 | Invalid parameter value. | 321| 8300002 | Service connection failed. | 322| 8300003 | System internal error. | 323| 8300999 | Unknown error. | 324 325**Example** 326 327```ts 328import { BusinessError } from '@kit.BasicServicesKit'; 329 330let slotId: number = 0; 331radio.getNetworkSelectionMode(slotId).then((data: radio.NetworkSelectionMode) => { 332 console.log(`getNetworkSelectionMode success, promise: data->${JSON.stringify(data)}`); 333}).catch((err: BusinessError) => { 334 console.error(`getNetworkSelectionMode failed, promise: err->${JSON.stringify(err)}`); 335}); 336``` 337 338 339## radio.getISOCountryCodeForNetwork<sup>7+</sup> 340 341getISOCountryCodeForNetwork\(slotId: number, callback: AsyncCallback\<string\>\): void 342 343Obtains 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. 344 345**System capability**: SystemCapability.Telephony.CoreService 346 347**Parameters** 348 349| Name | Type | Mandatory| Description | 350| -------- | ----------------------- | ---- | ---------------------------------------- | 351| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 | 352| callback | AsyncCallback\<string\> | Yes | Callback used to return the result, which is an ISO country code, for example, **CN** (China). If the device is not registered with any network, an empty string is returned.| 353 354**Error codes** 355 356For details about the error codes, see[ohos.telephony (Telephony) Error Codes](errorcode-telephony.md). 357 358| ID| Error Message | 359| -------- | -------------------------------------------- | 360| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 361| 8300001 | Invalid parameter value. | 362| 8300002 | Service connection failed. | 363| 8300003 | System internal error. | 364| 8300999 | Unknown error. | 365 366**Example** 367 368```ts 369import { BusinessError } from '@kit.BasicServicesKit'; 370 371let slotId: number = 0; 372radio.getISOCountryCodeForNetwork(slotId, (err: BusinessError, data: string) => { 373 if (err) { 374 console.error(`getISOCountryCodeForNetwork failed, callback: err->${JSON.stringify(err)}`); 375 return; 376 } 377 console.log(`getISOCountryCodeForNetwork success, callback: data->${JSON.stringify(data)}`); 378}); 379``` 380 381 382## radio.getISOCountryCodeForNetwork<sup>7+</sup> 383 384getISOCountryCodeForNetwork\(slotId: number\): Promise\<string\> 385 386Obtains 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. 387 388**System capability**: SystemCapability.Telephony.CoreService 389 390**Parameters** 391 392| Name| Type | Mandatory| Description | 393| ------ | ------ | ---- | -------------------------------------- | 394| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 395 396**Return value** 397 398| Type | Description | 399| ----------------- | ------------------------------------------------------------ | 400| Promise\<string\> | Promise used to return the result, which is an ISO country code, for example, **CN** (China). If the device is not registered with any network, an empty string is returned.| 401 402**Error codes** 403 404For details about the error codes, see[ohos.telephony (Telephony) Error Codes](errorcode-telephony.md). 405 406| ID| Error Message | 407| -------- | -------------------------------------------- | 408| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 409| 8300001 | Invalid parameter value. | 410| 8300002 | Service connection failed. | 411| 8300003 | System internal error. | 412| 8300999 | Unknown error. | 413 414**Example** 415 416```ts 417import { BusinessError } from '@kit.BasicServicesKit'; 418 419let slotId: number = 0; 420radio.getISOCountryCodeForNetwork(slotId).then((data: string) => { 421 console.log(`getISOCountryCodeForNetwork success, promise: data->${JSON.stringify(data)}`); 422}).catch((err: BusinessError) => { 423 console.error(`getISOCountryCodeForNetwork failed, promise: err->${JSON.stringify(err)}`); 424}); 425``` 426 427## radio.getISOCountryCodeForNetworkSync<sup>10+</sup> 428 429getISOCountryCodeForNetworkSync\(slotId: number\): string 430 431Obtains the ISO country code of the network with which the SIM card in the specified slot is registered. 432 433**System capability**: SystemCapability.Telephony.CoreService 434 435**Parameters** 436 437| Name| Type | Mandatory| Description | 438| ------ | ------ | ---- | -------------------------------------- | 439| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 440 441**Return value** 442 443| Type | Description | 444| ----------------- | ------------------------------------------------------------ | 445| string | ISO country code of the network, for example, **CN** (China). If the device is not registered with any network, an empty string is returned.| 446 447**Example** 448 449```ts 450let slotId: number = 0; 451let countryISO: string = radio.getISOCountryCodeForNetworkSync(slotId); 452console.log(`the country ISO is:` + countryISO); 453``` 454 455 456 457## radio.getPrimarySlotId<sup>7+</sup> 458 459getPrimarySlotId\(callback: AsyncCallback\<number\>\): void 460 461Obtains the ID of the slot in which the primary card is located. This API uses an asynchronous callback to return the result. 462 463**System capability**: SystemCapability.Telephony.CoreService 464 465**Parameters** 466 467| Name | Type | Mandatory| Description | 468| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | 469| callback | AsyncCallback\<number\> | Yes | Callback used to return the result. | 470 471**Error codes** 472 473For details about the error codes, see[ohos.telephony (Telephony) Error Codes](errorcode-telephony.md). 474 475| ID| Error Message | 476| -------- | -------------------------------------------- | 477| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 478| 8300001 | Invalid parameter value. | 479| 8300002 | Service connection failed. | 480| 8300003 | System internal error. | 481| 8300999 | Unknown error. | 482 483**Example** 484 485```ts 486import { BusinessError } from '@kit.BasicServicesKit'; 487 488radio.getPrimarySlotId((err: BusinessError, data: number) => { 489 if (err) { 490 console.error(`getPrimarySlotId failed, callback: err->${JSON.stringify(err)}`); 491 return; 492 } 493 console.log(`getPrimarySlotId success, callback: data->${JSON.stringify(data)}`); 494}); 495``` 496 497 498## radio.getPrimarySlotId<sup>7+</sup> 499 500getPrimarySlotId\(\): Promise\<number\> 501 502Obtains the ID of the slot in which the primary card is located. This API uses a promise to return the result. 503 504**System capability**: SystemCapability.Telephony.CoreService 505 506**Return value** 507 508| Type | Description | 509| ----------------------------------------------------------- | ------------------------------------------------------------ | 510| Promise\<number\> | Promise used to return the result.| 511 512**Error codes** 513 514For details about the error codes, see[ohos.telephony (Telephony) Error Codes](errorcode-telephony.md). 515 516| ID| Error Message | 517| -------- | -------------------------------------------- | 518| 8300002 | Service connection failed. | 519| 8300003 | System internal error. | 520| 8300999 | Unknown error. | 521 522**Example** 523 524```ts 525import { BusinessError } from '@kit.BasicServicesKit'; 526 527radio.getPrimarySlotId().then((data: number) => { 528 console.log(`getPrimarySlotId success, promise: data->${JSON.stringify(data)}`); 529}).catch((err: BusinessError) => { 530 console.error(`getPrimarySlotId failed, promise: err->${JSON.stringify(err)}`); 531}); 532``` 533 534 535## radio.getSignalInformation<sup>7+</sup> 536 537getSignalInformation\(slotId: number, callback: AsyncCallback\<Array\<SignalInformation\>\>\): void 538 539Obtains 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. 540 541**System capability**: SystemCapability.Telephony.CoreService 542 543**Parameters** 544 545| Name | Type | Mandatory| Description | 546| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | 547| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 | 548| callback | AsyncCallback\<Array\<[SignalInformation](#signalinformation)\>\> | Yes | Callback used to return the result, which is an array of child class objects derived from [SignalInformation](#signalinformation).| 549 550**Error codes** 551 552For details about the error codes, see[ohos.telephony (Telephony) Error Codes](errorcode-telephony.md). 553 554| ID| Error Message | 555| -------- | -------------------------------------------- | 556| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 557| 8300001 | Invalid parameter value. | 558| 8300002 | Service connection failed. | 559| 8300003 | System internal error. | 560| 8300999 | Unknown error. | 561 562**Example** 563 564```ts 565import { BusinessError } from '@kit.BasicServicesKit'; 566 567let slotId: number = 0; 568radio.getSignalInformation(slotId, (err: BusinessError, data: Array<radio.SignalInformation>) => { 569 if (err) { 570 console.error(`getSignalInformation failed, callback: err->${JSON.stringify(err)}`); 571 return; 572 } 573 console.log(`getSignalInformation success, callback: data->${JSON.stringify(data)}`); 574}); 575``` 576 577 578## radio.getSignalInformation<sup>7+</sup> 579 580getSignalInformation\(slotId: number\): Promise\<Array\<SignalInformation\>\> 581 582Obtains 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. 583 584**System capability**: SystemCapability.Telephony.CoreService 585 586**Parameters** 587 588| Name| Type | Mandatory| Description | 589| ------ | ------ | ---- | -------------------------------------- | 590| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 591 592**Return value** 593 594| Type | Description | 595| ----------------------------------------------------------- | ------------------------------------------------------------ | 596| Promise\<Array\<[SignalInformation](#signalinformation)\>\> | Promise used to return the result, which is a list of child class objects derived from [SignalInformation](#signalinformation).| 597 598**Error codes** 599 600For details about the error codes, see[ohos.telephony (Telephony) Error Codes](errorcode-telephony.md). 601 602| ID| Error Message | 603| -------- | -------------------------------------------- | 604| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 605| 8300001 | Invalid parameter value. | 606| 8300002 | Service connection failed. | 607| 8300003 | System internal error. | 608| 8300999 | Unknown error. | 609 610**Example** 611 612```ts 613import { BusinessError } from '@kit.BasicServicesKit'; 614 615let slotId: number = 0; 616radio.getSignalInformation(slotId).then((data: Array<radio.SignalInformation>) => { 617 console.log(`getSignalInformation success, promise: data->${JSON.stringify(data)}`); 618}).catch((err: BusinessError) => { 619 console.error(`getSignalInformation failed, promise: err->${JSON.stringify(err)}`); 620}); 621``` 622 623## radio.getSignalInformationSync<sup>10+</sup> 624 625getSignalInformationSync\(slotId: number\): Array\<SignalInformation\> 626 627Obtains a list of signal strengths of the network with which the SIM card in the specified slot is registered. 628 629**System capability**: SystemCapability.Telephony.CoreService 630 631**Parameters** 632 633| Name| Type | Mandatory| Description | 634| ------ | ------ | ---- | -------------------------------------- | 635| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 636 637**Return value** 638 639| Type | Description | 640| ----------------------------------------------------------- | ------------------------------------------------------------ | 641| Array\<[SignalInformation](#signalinformation)\>| Array of child class objects derived from [SignalInformation](#signalinformation).| 642 643 644**Example** 645 646```ts 647let slotId: number = 0; 648let signalInfo: Array<radio.SignalInformation> = radio.getSignalInformationSync(slotId); 649console.log(`signal information size is:` + signalInfo.length); 650``` 651 652## radio.isNrSupported<sup>8+(deprecated)</sup> 653 654isNrSupported\(\): boolean 655 656Check whether the current device supports NR. 657 658> **NOTE** 659> 660> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [isNRSupported](#radioisnrsupported9). 661 662**System capability**: SystemCapability.Telephony.CoreService 663 664**Return value** 665 666| Type | Description | 667| ------- | -------------------------------- | 668| boolean | - **true**: The current device supports 5G \(NR\).<br>- **false**: The current device does not support 5G \(NR\).| 669 670**Example** 671 672```ts 673let result: boolean = radio.isNrSupported(); 674console.log("Result: "+ result); 675``` 676 677## radio.isNrSupported<sup>(deprecated)</sup> 678 679isNrSupported\(slotId: number\): boolean 680 681Check whether the SIM card in the specified slot supports NR. 682 683> **NOTE** 684> 685> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [isNRSupported](#radioisnrsupported9-1). 686 687**System capability**: SystemCapability.Telephony.CoreService 688 689**Parameters** 690 691| Name| Type | Mandatory| Description | 692| ------ | ------ | ---- | -------------------------------------- | 693| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 694 695**Return value** 696 697| Type | Description | 698| ------------------ | ------------------------------------------------------------ | 699| boolean | - **true**: The current device supports 5G \(NR\).<br>- **false**: The current device does not support 5G \(NR\).| 700 701**Example** 702 703```ts 704let slotId: number = 0; 705let result: boolean = radio.isNrSupported(slotId); 706console.log("Result: "+ result); 707``` 708 709 710## radio.isNRSupported<sup>9+</sup> 711 712isNRSupported\(\): boolean 713 714Check whether the current device supports NR. 715 716**System capability**: SystemCapability.Telephony.CoreService 717 718**Return value** 719 720| Type | Description | 721| ------- | -------------------------------- | 722| boolean | - **true**: The current device supports 5G \(NR\).<br>- **false**: The current device does not support 5G \(NR\).| 723 724**Example** 725 726```ts 727let result: boolean = radio.isNRSupported(); 728console.log("Result: "+ result); 729``` 730 731 732## radio.isNRSupported<sup>9+</sup> 733 734isNRSupported\(slotId: number\): boolean 735 736Check whether the SIM card in the specified slot supports NR. 737 738**System capability**: SystemCapability.Telephony.CoreService 739 740**Parameters** 741 742| Name| Type | Mandatory| Description | 743| ------ | ------ | ---- | -------------------------------------- | 744| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 745 746**Return value** 747 748| Type | Description | 749| ------------------ | ------------------------------------------------------------ | 750| boolean | - **true**: The current device supports 5G \(NR\).<br>- **false**: The current device does not support 5G \(NR\).| 751 752**Example** 753 754```ts 755let slotId: number = 0; 756let result: boolean = radio.isNRSupported(slotId); 757console.log("Result: "+ result); 758``` 759 760 761## radio.isRadioOn<sup>7+</sup> 762 763isRadioOn\(callback: AsyncCallback\<boolean\>\): void 764 765Checks whether the radio service is enabled on the primary SIM card. This API uses an asynchronous callback to return the result. 766 767**Required permission**: ohos.permission.GET_NETWORK_INFO 768 769**System capability**: SystemCapability.Telephony.CoreService 770 771**Parameters** 772 773| Name | Type | Mandatory| Description | 774| -------- | ------------------------ | ---- | ------------------------------------------------------- | 775| callback | AsyncCallback\<boolean\> | Yes | Callback used to return the result. <br>- **true**: The radio service is enabled.<br>- **false**: The radio service is disabled.| 776 777**Error codes** 778 779For details about the error codes, see[ohos.telephony (Telephony) Error Codes](errorcode-telephony.md). 780 781| ID| Error Message | 782| -------- | -------------------------------------------- | 783| 201 | Permission denied. | 784| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 785| 8300001 | Invalid parameter value. | 786| 8300002 | Service connection failed. | 787| 8300003 | System internal error. | 788| 8300999 | Unknown error. | 789 790**Example** 791 792```ts 793import { BusinessError } from '@kit.BasicServicesKit'; 794 795radio.isRadioOn((err: BusinessError, data: boolean) => { 796 if (err) { 797 console.error(`isRadioOn failed, callback: err->${JSON.stringify(err)}`); 798 return; 799 } 800 console.log(`isRadioOn success, callback: data->${JSON.stringify(data)}`); 801}); 802``` 803 804 805## radio.isRadioOn<sup>7+</sup> 806 807isRadioOn\(slotId: number, callback: AsyncCallback\<boolean\>\): void 808 809Checks whether the radio service is enabled on the SIM card in the specified slot. This API uses an asynchronous callback to return the result. 810 811**Required permission**: ohos.permission.GET_NETWORK_INFO 812 813**System capability**: SystemCapability.Telephony.CoreService 814 815**Parameters** 816 817| Name | Type | Mandatory| Description | 818| -------- | ------------------------ | ---- | ------------------------------------------------------- | 819| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 | 820| callback | AsyncCallback\<boolean\> | Yes | Callback used to return the result. <br>- **true**: The radio service is enabled.<br>- **false**: The radio service is disabled.| 821 822**Error codes** 823 824For details about the error codes, see[ohos.telephony (Telephony) Error Codes](errorcode-telephony.md). 825 826| ID| Error Message | 827| -------- | -------------------------------------------- | 828| 201 | Permission denied. | 829| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 830| 8300001 | Invalid parameter value. | 831| 8300002 | Service connection failed. | 832| 8300003 | System internal error. | 833| 8300999 | Unknown error. | 834 835**Example** 836 837```ts 838import { BusinessError } from '@kit.BasicServicesKit'; 839 840let slotId: number = 0; 841radio.isRadioOn(slotId, (err: BusinessError, data: boolean) => { 842 if (err) { 843 console.error(`isRadioOn failed, callback: err->${JSON.stringify(err)}`); 844 return; 845 } 846 console.log(`isRadioOn success, callback: data->${JSON.stringify(data)}`); 847}); 848``` 849 850 851## radio.isRadioOn<sup>7+</sup> 852 853isRadioOn\(slotId?: number\): Promise\<boolean\> 854 855Checks whether the radio service is enabled on the SIM card in the specified slot. This API uses a promise to return the result. 856 857**Required permission**: ohos.permission.GET_NETWORK_INFO 858 859**System capability**: SystemCapability.Telephony.CoreService 860 861**Parameters** 862 863| Name| Type | Mandatory| Description | 864| ------ | ------ | ---- | -------------------------------------- | 865| 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.| 866 867**Return value** 868 869| Type | Description | 870| ------------------ | ------------------------------------------------------------ | 871| Promise\<boolean\> | Promise used to return the result.<br>- **true**: The radio service is enabled.<br>- **false**: The radio service is disabled.| 872 873**Error codes** 874 875For details about the error codes, see[ohos.telephony (Telephony) Error Codes](errorcode-telephony.md). 876 877| ID| Error Message | 878| -------- | -------------------------------------------- | 879| 201 | Permission denied. | 880| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 881| 8300001 | Invalid parameter value. | 882| 8300002 | Service connection failed. | 883| 8300003 | System internal error. | 884| 8300999 | Unknown error. | 885 886**Example** 887 888```ts 889import { BusinessError } from '@kit.BasicServicesKit'; 890 891let slotId: number = 0; 892radio.isRadioOn(slotId).then((data: boolean) => { 893 console.log(`isRadioOn success, promise: data->${JSON.stringify(data)}`); 894}).catch((err: BusinessError) => { 895 console.error(`isRadioOn failed, promise: err->${JSON.stringify(err)}`); 896}); 897``` 898 899 900## radio.getOperatorName<sup>7+</sup> 901 902getOperatorName\(slotId: number, callback: AsyncCallback\<string\>\): void 903 904Obtains the carrier name of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. 905 906**System capability**: SystemCapability.Telephony.CoreService 907 908**Parameters** 909 910| Name | Type | Mandatory| Description | 911| -------- | ----------------------- | ---- | ------------------------------------------ | 912| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 | 913| callback | AsyncCallback\<string\> | Yes | Callback used to return the result, which is the carrier name, for example, China Mobile.| 914 915**Error codes** 916 917For details about the error codes, see[ohos.telephony (Telephony) Error Codes](errorcode-telephony.md). 918 919| ID| Error Message | 920| -------- | -------------------------------------------- | 921| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 922| 8300001 | Invalid parameter value. | 923| 8300002 | Service connection failed. | 924| 8300003 | System internal error. | 925| 8300999 | Unknown error. | 926 927**Example** 928 929```ts 930import { BusinessError } from '@kit.BasicServicesKit'; 931 932let slotId: number = 0; 933radio.getOperatorName(slotId, (err: BusinessError, data: string) => { 934 if (err) { 935 console.error(`getOperatorName failed, callback: err->${JSON.stringify(err)}`); 936 return; 937 } 938 console.log(`getOperatorName success, callback: data->${JSON.stringify(data)}`); 939}); 940``` 941 942 943## radio.getOperatorName<sup>7+</sup> 944 945getOperatorName\(slotId: number\): Promise\<string\> 946 947Obtains the carrier name of the SIM card in the specified slot. This API uses a promise to return the result. 948 949**System capability**: SystemCapability.Telephony.CoreService 950 951**Parameters** 952 953| Name| Type | Mandatory| Description | 954| ------ | ------ | ---- | -------------------------------------- | 955| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 956 957**Return value** 958 959| Type | Description | 960| ----------------- | ------------------------------------------------------------ | 961| Promise\<string\> | Promise used t return the result, which is the carrier name, for example, China Mobile. | 962 963**Error codes** 964 965For details about the error codes, see[ohos.telephony (Telephony) Error Codes](errorcode-telephony.md). 966 967| ID| Error Message | 968| -------- | -------------------------------------------- | 969| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 970| 8300001 | Invalid parameter value. | 971| 8300002 | Service connection failed. | 972| 8300003 | System internal error. | 973| 8300999 | Unknown error. | 974 975**Example** 976 977```ts 978import { BusinessError } from '@kit.BasicServicesKit'; 979 980let slotId: number = 0; 981radio.getOperatorName(slotId).then((data: string) => { 982 console.log(`getOperatorName success, promise: data->${JSON.stringify(data)}`); 983}).catch((err: BusinessError) => { 984 console.error(`getOperatorName failed, promise: err->${JSON.stringify(err)}`); 985}); 986``` 987 988## radio.getOperatorNameSync<sup>10+</sup> 989 990getOperatorNameSync\(slotId: number\): string 991 992Obtains the carrier name of the SIM card in the specified slot. 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 1002**Return value** 1003 1004| Type | Description | 1005| ----------------- | ------------------------------------------------------------ | 1006| string | Carrier name, for example, China Mobile. | 1007 1008 1009**Example** 1010 1011```ts 1012let slotId: number = 0; 1013let operatorName: string = radio.getOperatorNameSync(slotId); 1014console.log(`operator name is:` + operatorName); 1015``` 1016 1017 1018## NetworkRadioTech<sup>11+</sup> 1019 1020Defines the radio access technology for the packet switched (PS) or circuit switched (CS) network. 1021 1022**System capability**: SystemCapability.Telephony.CoreService 1023 1024| Name | Type | Mandatory| Description | 1025| --------------- | --------------------------- | ---- | ------------------ | 1026| psRadioTech | [RadioTechnology](#radiotechnology) | Yes | PS.| 1027| csRadioTech | [RadioTechnology](#radiotechnology) | Yes | CS.| 1028 1029## RadioTechnology 1030 1031Enumerates radio access technologies. 1032 1033**System capability**: SystemCapability.Telephony.CoreService 1034 1035| Name | Value | Description | 1036| ------------------------- | ---- | ------------------------------------------------------------ | 1037| RADIO_TECHNOLOGY_UNKNOWN | 0 | Unknown RAT | 1038| RADIO_TECHNOLOGY_GSM | 1 | Global System for Mobile Communication (GSM) | 1039| RADIO_TECHNOLOGY_1XRTT | 2 | Single-Carrier Radio Transmission Technology (1XRTT)| 1040| RADIO_TECHNOLOGY_WCDMA | 3 | Wideband Code Division Multiple Access (WCDMA)| 1041| RADIO_TECHNOLOGY_HSPA | 4 | High Speed Packet Access (HSPA) | 1042| RADIO_TECHNOLOGY_HSPAP | 5 | Evolved High Speed Packet Access (HSPA+) | 1043| RADIO_TECHNOLOGY_TD_SCDMA | 6 | TD-SCDMA.| 1044| RADIO_TECHNOLOGY_EVDO | 7 | Evolution-Data Optimized (EVDO) | 1045| RADIO_TECHNOLOGY_EHRPD | 8 | Evolved High Rate Package Data (EHRPD) | 1046| RADIO_TECHNOLOGY_LTE | 9 | Long Term Evolution (LTE) | 1047| RADIO_TECHNOLOGY_LTE_CA | 10 | Long Term Evolution_Carrier Aggregation (LTE_CA)| 1048| RADIO_TECHNOLOGY_IWLAN | 11 | Industrial Wireless LAN (IWLAN) | 1049| RADIO_TECHNOLOGY_NR | 12 | New Radio (NR) | 1050 1051 1052## SignalInformation 1053 1054Defines the signal strength. 1055 1056**System capability**: SystemCapability.Telephony.CoreService 1057 1058| Name | Type | Mandatory| Description | 1059| --------------- | --------------------------- | ---- | ------------------ | 1060| signalType | [NetworkType](#networktype) | Yes | Signal strength type.| 1061| signalLevel | number | Yes | Signal strength level.| 1062| dBm<sup>9+</sup>| number | Yes | Signal strength, in dBm. | 1063 1064## NetworkType 1065 1066Enumerates network types. 1067 1068**System capability**: SystemCapability.Telephony.CoreService 1069 1070| Name | Value | Description | 1071| -------------------- | ---- | ------------------------------------------------------------ | 1072| NETWORK_TYPE_UNKNOWN | 0 | Unknown network. | 1073| NETWORK_TYPE_GSM | 1 | GSM network. | 1074| NETWORK_TYPE_CDMA | 2 | CDMA network. | 1075| NETWORK_TYPE_WCDMA | 3 | WCDMA network. | 1076| NETWORK_TYPE_TDSCDMA | 4 | TD-SCDMA network.| 1077| NETWORK_TYPE_LTE | 5 | LTE network. | 1078| NETWORK_TYPE_NR | 6 | NR network. | 1079 1080## NetworkState 1081 1082Defines the network status. 1083 1084**System capability**: SystemCapability.Telephony.CoreService 1085 1086| Name | Type | Mandatory| Description | 1087| -------------------- | ----------------------------------- | ---- | ------------------------------------------------------------ | 1088| longOperatorName | string | Yes | Long carrier name of the registered network. | 1089| shortOperatorName | string | Yes | Short carrier name of the registered network. | 1090| plmnNumeric | string | Yes | PLMN code of the registered network. | 1091| isRoaming | boolean | Yes | Whether the user is roaming. | 1092| regState | [RegState](#regstate) | Yes | Network registration status of the device. | 1093| cfgTech<sup>8+</sup> | [RadioTechnology](#radiotechnology) | Yes | RAT of the device. | 1094| nsaState | [NsaState](#nsastate) | Yes | NSA network registration status of the device. | 1095| isCaActive | boolean | Yes | CA status. | 1096| isEmergency | boolean | Yes | Whether only emergency calls are allowed. | 1097 1098 1099## RegState 1100 1101Defines the network registration status of the device. 1102 1103**System capability**: SystemCapability.Telephony.CoreService 1104 1105| Name | Value | Description | 1106| ----------------------------- | ---- | -------------------------- | 1107| REG_STATE_NO_SERVICE | 0 | The device cannot use any services, including data, SMS, and call services. | 1108| REG_STATE_IN_SERVICE | 1 | The device can use services properly, including data, SMS, and call services. | 1109| REG_STATE_EMERGENCY_CALL_ONLY | 2 | The device can use only the emergency call service.| 1110| 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. | 1111 1112 1113## NsaState 1114 1115Enumerates NSA network states. 1116 1117**System capability**: SystemCapability.Telephony.CoreService 1118 1119| Name | Value | Description | 1120| -------------------------- | ---- | ---------------------------------------------------------- | 1121| NSA_STATE_NOT_SUPPORT | 1 | The device is in idle or connected state in an LTE cell that does not support NSA. | 1122| NSA_STATE_NO_DETECT | 2 | The device is in the idle state in an LTE cell that supports NSA but not NR coverage detection.| 1123| NSA_STATE_CONNECTED_DETECT | 3 | The device is connected to the LTE network in an LTE cell that supports NSA and NR coverage detection. | 1124| NSA_STATE_IDLE_DETECT | 4 | The device is in the idle state in an LTE cell that supports NSA and NR coverage detection. | 1125| NSA_STATE_DUAL_CONNECTED | 5 | The device is connected to the LTE/NR network in an LTE cell that supports NSA. | 1126| NSA_STATE_SA_ATTACHED | 6 | The device is idle or connected to the NG-RAN cell when being attached to the 5G Core. | 1127 1128 1129## NetworkSelectionMode 1130 1131Enumerates network selection modes. 1132 1133**System capability**: SystemCapability.Telephony.CoreService 1134 1135| Name | Value | Description | 1136| --------------------------- | ---- | -------------- | 1137| NETWORK_SELECTION_UNKNOWN | 0 | Unknown network selection mode.| 1138| NETWORK_SELECTION_AUTOMATIC | 1 | Automatic network selection mode.| 1139| NETWORK_SELECTION_MANUAL | 2 | Manual network selection mode.| 1140 1141 1142## CellInformation<sup>8+</sup> 1143 1144Defines the cell information. 1145 1146**System capability**: SystemCapability.Telephony.CoreService 1147 1148| Name | Type | Mandatory| Description | 1149| ----------------- | --------------------------------------- | ---- | ------------------------------------------------------------ | 1150| networkType | [NetworkType](#networktype) | Yes | Network type of the cell. | 1151| signalInformation | [SignalInformation](#signalinformation) | Yes | Signal information. | 1152