1# @ohos.telephony.data (Cellular Data) 2 3The **data** module provides basic mobile data management functions. With the APIs provided by this module, you can obtain the default slot of the SIM card used for mobile data, obtain the cellular data flow type and connection status, and check whether cellular data and roaming are enabled. 4 5> **NOTE** 6> 7> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. 8 9## Modules to Import 10 11```ts 12import { data } from '@kit.TelephonyKit'; 13``` 14 15## data.getDefaultCellularDataSlotId 16 17getDefaultCellularDataSlotId(callback: AsyncCallback\<number\>): void 18 19Obtains the default slot of the SIM card used for mobile data. This API uses an asynchronous callback to return the result. 20 21**System capability**: SystemCapability.Telephony.CellularData 22 23**Parameters** 24 25| Name | Type | Mandatory| Description | 26| -------- | ----------------------- | ---- | ------------------------------------------ | 27| callback | AsyncCallback\<number\> | Yes | Callback used to return the result.<br>- **0**: card slot 1.<br>- **1**: card slot 2| 28 29**Example** 30 31```ts 32import { data } from '@kit.TelephonyKit'; 33import { BusinessError } from '@kit.BasicServicesKit'; 34 35data.getDefaultCellularDataSlotId((err: BusinessError, contextData: number) => { 36 if(err){ 37 console.error(`getDefaultCellularDataSlotId fail,callback: err->${JSON.stringify(err)}, contextData->${JSON.stringify(contextData)}`); 38 }else{ 39 console.log(`getDefaultCellularDataSlotId success`); 40 } 41}); 42``` 43 44## data.getDefaultCellularDataSlotId 45 46getDefaultCellularDataSlotId(): Promise\<number\> 47 48Obtains the default slot of the SIM card used for mobile data. This API uses a promise to return the result. 49 50**System capability**: SystemCapability.Telephony.CellularData 51 52**Return value** 53 54| Type | Description | 55| ----------------- | ------------------------------------------------------------ | 56| Promise\<number\> | Promise used to return the result.<br>- **0**: card slot 1.<br>- **1**: card slot 2| 57 58**Example** 59 60```ts 61import { data } from '@kit.TelephonyKit'; 62import { BusinessError } from '@kit.BasicServicesKit'; 63 64data.getDefaultCellularDataSlotId().then((contextData: number) => { 65 console.log(`getDefaultCellularDataSlotId success, promise: contextData->${JSON.stringify(contextData)}`); 66}).catch((err: BusinessError) => { 67 console.error(`getDefaultCellularDataSlotId fail, promise: err->${JSON.stringify(err)}`); 68}); 69``` 70 71## data.getDefaultCellularDataSlotIdSync<sup>9+</sup> 72 73getDefaultCellularDataSlotIdSync(): number 74 75Card slot ID. 76 77**System capability**: SystemCapability.Telephony.CellularData 78 79**Return value** 80 81| Type | Description | 82| ------ | -------------------------------------------------- | 83| number | Card slot ID.<br>- **0**: card slot 1.<br>- **1**: card slot 2| 84 85**Example** 86 87```ts 88import { data } from '@kit.TelephonyKit'; 89 90console.log("Result: "+ data.getDefaultCellularDataSlotIdSync()) 91``` 92 93 94## data.getCellularDataFlowType 95 96getCellularDataFlowType(callback: AsyncCallback\<DataFlowType\>): void 97 98Obtains the cellular data flow type, which can be uplink or downlink. This API uses an asynchronous callback to return the result. 99 100**System capability**: SystemCapability.Telephony.CellularData 101 102**Parameters** 103 104| Name | Type | Mandatory| Description | 105| -------- | ---------------------------------------------- | ---- | ---------- | 106| callback | AsyncCallback\<[DataFlowType](#dataflowtype)\> | Yes | Callback used to return the result.| 107 108**Example** 109 110```ts 111import { data } from '@kit.TelephonyKit'; 112import { BusinessError } from '@kit.BasicServicesKit'; 113 114data.getCellularDataFlowType((err: BusinessError, contextData: data.DataFlowType) => { 115 if(err){ 116 console.error(`getCellularDataFlowType fail,callback: err->${JSON.stringify(err)}, contextData->${JSON.stringify(contextData)}`); 117 }else{ 118 console.log(`getCellularDataFlowType success`); 119 } 120}); 121``` 122 123## data.getCellularDataFlowType 124 125getCellularDataFlowType(): Promise\<DataFlowType\> 126 127Obtains the cellular data flow type, which can be uplink or downlink. This API uses a promise to return the result. 128 129**System capability**: SystemCapability.Telephony.CellularData 130 131**Return value** 132 133| Type | Description | 134| ---------------------------------------- | ----------------------------------------------- | 135| Promise\<[DataFlowType](#dataflowtype)\> | Promise used to return the result. | 136 137**Example** 138 139```ts 140import { data } from '@kit.TelephonyKit'; 141import { BusinessError } from '@kit.BasicServicesKit'; 142 143data.getCellularDataFlowType().then((contextData: data.DataFlowType) => { 144 console.log(`getCellularDataFlowType success, promise: contextData->${JSON.stringify(contextData)}`); 145}).catch((err: BusinessError) => { 146 console.error(`getCellularDataFlowType fail, promise: err->${JSON.stringify(err)}`); 147}); 148``` 149 150## data.getCellularDataState 151 152getCellularDataState(callback: AsyncCallback\<DataConnectState\>): void 153 154Obtains the cellular data connection status. This API uses an asynchronous callback to return the result. 155 156**System capability**: SystemCapability.Telephony.CellularData 157 158**Parameters** 159 160| Name | Type | Mandatory| Description | 161| -------- | ------------------------------------------------------ | ---- | ---------- | 162| callback | AsyncCallback\<[DataConnectState](#dataconnectstate)\> | Yes | Callback used to return the result.| 163 164**Example** 165 166```ts 167import { data } from '@kit.TelephonyKit'; 168import { BusinessError } from '@kit.BasicServicesKit'; 169 170data.getCellularDataState((err: BusinessError, contextData: data.DataConnectState) => { 171 if(err){ 172 console.error(`getCellularDataState fail,callback: err->${JSON.stringify(err)}, contextData->${JSON.stringify(contextData)}`); 173 }else{ 174 console.log(`getCellularDataState success`); 175 } 176}); 177``` 178 179## data.getCellularDataState 180 181getCellularDataState(): Promise\<DataConnectState\> 182 183Obtains the cellular data connection status. This API uses a promise to return the result. 184 185**System capability**: SystemCapability.Telephony.CellularData 186 187**Return value** 188 189| Type | Description | 190| ------------------------------------------------ | ------------------------------------- | 191| Promise\<[DataConnectState](#dataconnectstate)\> | Promise used to return the result.| 192 193**Example** 194 195```ts 196import { data } from '@kit.TelephonyKit'; 197import { BusinessError } from '@kit.BasicServicesKit'; 198 199data.getCellularDataState().then((contextData: data.DataConnectState) => { 200 console.log(`getCellularDataState success, promise: contextData->${JSON.stringify(contextData)}`); 201}).catch((err: BusinessError) => { 202 console.error(`getCellularDataState fail, promise: err->${JSON.stringify(err)}`); 203}); 204``` 205 206## data.isCellularDataEnabled 207 208isCellularDataEnabled(callback: AsyncCallback\<boolean\>): void 209 210Checks whether the cellular data service is enabled. This API uses an asynchronous callback to return the result. 211 212**Required permission**: ohos.permission.GET_NETWORK_INFO 213 214**System capability**: SystemCapability.Telephony.CellularData 215 216**Parameters** 217 218| Name | Type | Mandatory| Description | 219| -------- | ------------------------ | ---- | ------------------------------------------------------------ | 220| callback | AsyncCallback\<boolean\> | Yes | Callback used to return the result.<br>**true**: The cellular data service is enabled.<br>**false**: The cellular data service is disabled.| 221 222**Error codes** 223 224For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Telephony Error Codes](errorcode-telephony.md). 225 226| ID| Error Message | 227| -------- | -------------------------------------------- | 228| 201 | Permission denied. | 229| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 230| 8300001 | Invalid parameter value. | 231| 8300002 | Service connection failed. | 232| 8300003 | System internal error. | 233| 8300999 | Internal error. | 234 235**Example** 236 237```ts 238import { data } from '@kit.TelephonyKit'; 239import { BusinessError } from '@kit.BasicServicesKit'; 240 241data.isCellularDataEnabled((err: BusinessError, contextData: boolean) => { 242 if(err){ 243 console.error(`isCellularDataEnabled fail,callback: callback: err->${JSON.stringify(err)}, contextData->${JSON.stringify(contextData)}`); 244 }else{ 245 console.log(`isCellularDataEnabled success`); 246 } 247}); 248``` 249 250## data.isCellularDataEnabled 251 252isCellularDataEnabled(): Promise\<boolean\> 253 254Checks whether the cellular data service is enabled. This API uses a promise to return the result. 255 256**Required permission**: ohos.permission.GET_NETWORK_INFO 257 258**System capability**: SystemCapability.Telephony.CellularData 259 260**Return value** 261 262| Type | Description | 263| ------------------ | ------------------------------------------------------------ | 264| Promise\<boolean\> | Promise used to return the result.<br>**true**: The cellular data service is enabled.<br>**false**: The cellular data service is disabled.| 265 266**Error codes** 267 268For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Telephony Error Codes](errorcode-telephony.md). 269 270| ID| Error Message | 271| -------- | -------------------------------------------- | 272| 201 | Permission denied. | 273| 8300002 | Service connection failed. | 274| 8300003 | System internal error. | 275| 8300999 | Internal error. | 276 277**Example** 278 279```ts 280import { data } from '@kit.TelephonyKit'; 281import { BusinessError } from '@kit.BasicServicesKit'; 282 283data.isCellularDataEnabled().then((contextData: boolean) => { 284 console.log(`isCellularDataEnabled success, promise: contextData->${JSON.stringify(contextData)}`); 285}).catch((err: BusinessError) => { 286 console.error(`isCellularDataEnabled fail, promise: err->${JSON.stringify(err)}`); 287}); 288``` 289 290## data.isCellularDataEnabledSync<sup>12+</sup> 291 292isCellularDataEnabledSync(): boolean 293 294Checks whether the cellular data service is enabled. This API returns the result synchronously. 295 296**Required permission**: ohos.permission.GET_NETWORK_INFO 297 298**System capability**: SystemCapability.Telephony.CellularData 299 300**Return value** 301 302| Type | Description | 303| ------- | ------------------------------------------------------------ | 304| boolean | Whether the cellular data service is enabled.<br>**true**: The cellular data service is enabled.<br>**false**: The cellular data service is disabled.| 305 306**Error codes** 307 308For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Telephony Error Codes](errorcode-telephony.md). 309 310| ID| Error Message | 311| -------- | -------------------------------------------- | 312| 201 | Permission denied. | 313| 8300002 | Operation failed. Cannot connect to service. | 314| 8300003 | System internal error. | 315| 8300999 | Internal error. | 316 317**Example** 318 319<!--code_no_check--> 320 321```ts 322import { data } from '@kit.TelephonyKit'; 323 324try { 325 let isEnabled: boolean = data.isCellularDataEnabledSync(); 326 console.log(`isCellularDataEnabledSync success : ${isEnabled}`); 327} catch (error) { 328 console.error(`isCellularDataEnabledSync fail : err->${JSON.stringify(error)}`); 329} 330``` 331 332## data.isCellularDataRoamingEnabled 333 334isCellularDataRoamingEnabled(slotId: number, callback: AsyncCallback\<boolean\>): void 335 336Checks whether roaming is enabled for the cellular data service. This API uses an asynchronous callback to return the result. 337 338**Required permission**: ohos.permission.GET_NETWORK_INFO 339 340**System capability**: SystemCapability.Telephony.CellularData 341 342**Parameters** 343 344| Name | Type | Mandatory| Description | 345| -------- | ------------------------ | ---- | ------------------------------------------------------------ | 346| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1.<br>- **1**: card slot 2 | 347| callback | AsyncCallback\<boolean\> | Yes | Callback used to return the result.<br>**true**: Roaming is enabled for the cellular data service.<br>**false**: Roaming is disabled for the cellular data service.| 348 349**Error codes** 350 351For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Telephony Error Codes](errorcode-telephony.md). 352 353| ID| Error Message | 354| -------- | -------------------------------------------- | 355| 201 | Permission denied. | 356| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 357| 8300001 | Invalid parameter value. | 358| 8300002 | Service connection failed. | 359| 8300003 | System internal error. | 360| 8300999 | Internal error. | 361 362**Example** 363 364```ts 365import { data } from '@kit.TelephonyKit'; 366import { BusinessError } from '@kit.BasicServicesKit'; 367 368data.isCellularDataRoamingEnabled(0, (err: BusinessError, contextData: boolean) => { 369 if(err){ 370 console.error(`isCellularDataRoamingEnabled fail,callback: err->${JSON.stringify(err)}, contextData->${JSON.stringify(contextData)}`); 371 }else{ 372 console.log(`isCellularDataRoamingEnabled success`); 373 } 374}); 375``` 376 377## data.isCellularDataRoamingEnabled 378 379isCellularDataRoamingEnabled(slotId: number): Promise\<boolean\> 380 381Checks whether roaming is enabled for the cellular data service. This API uses a promise to return the result. 382 383**Required permission**: ohos.permission.GET_NETWORK_INFO 384 385**System capability**: SystemCapability.Telephony.CellularData 386 387**Parameters** 388 389| Name| Type | Mandatory| Description | 390| ------ | ------ | ---- | ---------------------------------------- | 391| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1.<br>- **1**: card slot 2| 392 393**Return value** 394 395| Type | Description | 396| ------------------ | ------------------------------------------------------------ | 397| Promise\<boolean\> | Promise used to return the result.<br>**true**: Roaming is enabled for the cellular data service.<br>**false**: Roaming is disabled for the cellular data service.| 398 399**Error codes** 400 401For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Telephony Error Codes](errorcode-telephony.md). 402 403| ID| Error Message | 404| -------- | -------------------------------------------- | 405| 201 | Permission denied. | 406| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 407| 8300001 | Invalid parameter value. | 408| 8300002 | Service connection failed. | 409| 8300003 | System internal error. | 410| 8300999 | Internal error. | 411 412**Example** 413 414```ts 415import { data } from '@kit.TelephonyKit'; 416import { BusinessError } from '@kit.BasicServicesKit'; 417 418data.isCellularDataRoamingEnabled(0).then((contextData: boolean) => { 419 console.log(`isCellularDataRoamingEnabled success, promise: contextData->${JSON.stringify(contextData)}`); 420}).catch((err: BusinessError) => { 421 console.error(`isCellularDataRoamingEnabled fail, promise: err->${JSON.stringify(err)}`); 422}); 423``` 424 425## data.isCellularDataRoamingEnabledSync<sup>12+</sup> 426 427isCellularDataRoamingEnabledSync(slotId: number): boolean 428 429Checks whether roaming is enabled for the cellular data service. This API returns the result synchronously. 430 431**Required permission**: ohos.permission.GET_NETWORK_INFO 432 433**System capability**: SystemCapability.Telephony.CellularData 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| boolean | Whether roaming is enabled for the cellular data service.<br>**true**: Roaming is enabled for the cellular data service.<br>**false**: Roaming is disabled for the cellular data service.| 446 447**Error codes** 448 449For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Telephony Error Codes](errorcode-telephony.md). 450 451| ID| Error Message | 452| -------- | ------------------------------------------------------------ | 453| 201 | Permission denied. | 454| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameters types. | 455| 8300001 | Invalid parameter value. | 456| 8300002 | Operation failed. Cannot connect to service. | 457| 8300003 | System internal error. | 458| 8300999 | Internal error. | 459 460**Example** 461 462<!--code_no_check--> 463 464```ts 465import { data } from '@kit.TelephonyKit'; 466 467try { 468 let isEnabled: boolean = data.isCellularDataRoamingEnabledSync(0); 469 console.log(`isCellularDataRoamingEnabledSync success : ${isEnabled}`); 470} catch (error) { 471 console.error(`isCellularDataRoamingEnabledSync fail : err->${JSON.stringify(error)}`); 472} 473``` 474 475## data.getDefaultCellularDataSimId<sup>10+</sup> 476 477getDefaultCellularDataSimId(): number 478 479Obtains the default ID of the SIM card used for mobile data. 480 481**System capability**: SystemCapability.Telephony.CellularData 482 483**Return value** 484 485| Type | Description | 486| ------ | -------------------------------------------------- | 487| number | Obtains the default ID of the SIM card used for mobile data.<br>The return value is bound to the SIM card and increases from 1.| 488 489**Example** 490 491```ts 492import { data } from '@kit.TelephonyKit'; 493 494console.log("Result: "+ data.getDefaultCellularDataSimId()); 495``` 496 497## data.queryAllApns<sup>16+</sup> 498 499queryAllApns(): Promise\<Array\<ApnInfo\>\> 500 501Obtains the access point name (APN) of the default SIM card used for mobile data. This API returns the result asynchronously. 502 503**Required permissions**: ohos.permission.MANAGE_APN_SETTING (Restricted permission used only to connect to the mobile data private network for office tasks. For details, see [Restricted Permissions](../../security/AccessToken/restricted-permissions.md#ohospermissionmanage_apn_setting).) 504 505**System capability**: SystemCapability.Telephony.CellularData 506 507**Return value** 508 509| Type | Description | 510| ------ |--------------------------------------------| 511| Promise\<Array\<[ApnInfo](#apninfo16)\>\> | Promise used to return the result.| 512 513**Error codes** 514 515For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 516 517| ID| Error Message | 518| -------- | ------------------------------------------------------------ | 519| 201 | Permission denied. | 520 521**Example** 522 523```ts 524import { data } from '@kit.TelephonyKit'; 525 526data.queryAllApns().then((data: Array<data.ApnInfo>) => { 527 console.info(`queryAllApns success, promise: data->${JSON.stringify(data)}`); 528}).catch((err: BusinessError) => { 529 console.error(`queryAllApns failed, promise: err->${JSON.stringify(err)}`); 530}); 531``` 532 533## data.queryApnIds<sup>16+</sup> 534 535queryApnIds(apnInfo: ApnInfo): Promise\<Array\<number\>\> 536 537Obtains the APN ID corresponding to the specified **ApnInfo**. This API returns the result asynchronously. 538 539**Required permissions**: ohos.permission.MANAGE_APN_SETTING (Restricted permission used only to connect to the mobile data private network for office tasks. For details, see [Restricted Permissions](../../security/AccessToken/restricted-permissions.md#ohospermissionmanage_apn_setting).) 540 541**System capability**: SystemCapability.Telephony.CellularData 542 543**Parameters** 544 545| Name| Type | Mandatory| Description | 546| ------ | ------ | ---- | ---------------------------------------- | 547| apnInfo | [ApnInfo](#apninfo16) | Yes | APN to query.| 548 549 550**Return value** 551 552| Type | Description | 553| ------ |-----------------------------| 554| Promise\<Array\<number\>\> | Promise used to return the result.| 555 556**Error codes** 557 558For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 559 560| ID| Error Message | 561| -------- | ------------------------------------------------------------ | 562| 201 | Permission denied. | 563 564**Example** 565 566```ts 567import { data } from '@kit.TelephonyKit'; 568 569let apnInfo: data.ApnInfo; 570apnInfo = { 571 apnName: "CMNET", 572 apn: "cmnet", 573 mcc: "460", 574 mnc: "07", 575}; 576 577data.queryApnIds(apnInfo).then((data: Array<number>) => { 578 console.info(`queryApnIds success, promise: data->${JSON.stringify(data)}`); 579}).catch((err: BusinessError) => { 580 console.error(`queryApnIds failed, promise: err->${JSON.stringify(err)}`); 581}); 582``` 583 584## data.setPreferredApn<sup>16+</sup> 585 586setPreferredApn(apnId: number): Promise\<boolean\> 587 588Sets the APN corresponding to the specified **apnId** as the preferred APN. This API returns the result asynchronously. 589 590> **NOTE** 591> 592> If the input APN ID is invalid, the default preferred APN configured by the carrier is used. 593 594**Required permissions**: ohos.permission.MANAGE_APN_SETTING (Restricted permission used only to connect to the mobile data private network for office tasks. For details, see [Restricted Permissions](../../security/AccessToken/restricted-permissions.md#ohospermissionmanage_apn_setting).) 595 596**System capability**: SystemCapability.Telephony.CellularData 597 598**Parameters** 599 600| Name| Type | Mandatory| Description | 601| ------ | ------ | ---- | ---------------------------------------- | 602| apnId | number | Yes | APN ID, which can be obtained by calling [queryApnIds](#dataqueryapnids16).| 603 604**Return value** 605 606| Type | Description | 607| ------ |------------------------| 608| Promise\<boolean\> | Promise used to return the result. If no SIM card is installed, the value **false** is returned.| 609 610**Error codes** 611 612For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 613 614| ID| Error Message | 615| -------- | ------------------------------------------------------------ | 616| 201 | Permission denied. | 617 618**Example** 619 620```ts 621import { data } from '@kit.TelephonyKit'; 622 623let apnId: number = 0; // apnId is a valid value returned by queryApnIds. If an invalid APN ID is passed to setPreferredApn, the default preferred APN configured by the carrier is used. 624data.setPreferredApn(apnId).then((data: boolean) => { 625 console.info(`setPreferredApn success, promise: data->${JSON.stringify(data)}`); 626}).catch((err: BusinessError) => { 627 console.error(`setPreferredApn failed, promise: err->${JSON.stringify(err)}`); 628}); 629``` 630 631## data.getActiveApnName<sup>20+</sup> 632 633getActiveApnName(): Promise\<string\> 634 635Obtains the access point name (APN) of the default SIM card used for mobile data. This API returns the result asynchronously. 636 637**Required permission**: ohos.permission.GET_NETWORK_INFO 638 639**System capability**: SystemCapability.Telephony.CellularData 640 641**Return value** 642 643| Type | Description | 644| ------ |--------------------------------------------| 645| Promise\<string\> | Promise used to return the result. If mobile data is not activated, an empty string is returned.| 646 647**Error codes** 648 649For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 650 651| ID| Error Message | 652| -------- | ------------------------------------------------------------ | 653| 201 | Permission denied. | 654 655**Example** 656 657```ts 658import { data } from '@kit.TelephonyKit'; 659 660data.getActiveApnName().then((data: string) => { 661 console.info(`getActiveApnName success, promise: data->${JSON.stringify(data)}`); 662}).catch((err: BusinessError) => { 663 console.error(`getActiveApnName failed, promise: err->${JSON.stringify(err)}`); 664}); 665``` 666 667## DataFlowType 668 669Defines the cellular data flow type. 670 671**System capability**: SystemCapability.Telephony.CellularData 672 673| Name | Value | Description | 674| ---------------------- | ---- | ------------------------------------------ | 675| DATA_FLOW_TYPE_NONE | 0 | No uplink or downlink data is available. | 676| DATA_FLOW_TYPE_DOWN | 1 | Only the downlink data is available. | 677| DATA_FLOW_TYPE_UP | 2 | Only the uplink data is available. | 678| DATA_FLOW_TYPE_UP_DOWN | 3 | Both the uplink data and downlink data are available. | 679| DATA_FLOW_TYPE_DORMANT | 4 | No uplink or downlink data is available because the lower-layer link is in the dormant state.| 680 681## DataConnectState 682 683Describes the connection status of a cellular data link. 684 685**System capability**: SystemCapability.Telephony.CellularData 686 687| Name | Value | Description | 688| ----------------------- | ---- | -------------------------- | 689| DATA_STATE_UNKNOWN | -1 | The status of the cellular data link is unknown. | 690| DATA_STATE_DISCONNECTED | 0 | The cellular data link is disconnected. | 691| DATA_STATE_CONNECTING | 1 | The cellular data link is being connected.| 692| DATA_STATE_CONNECTED | 2 | The cellular data link is connected. | 693| DATA_STATE_SUSPENDED | 3 | The cellular data link is suspended. | 694 695## ApnInfo<sup>16+</sup> 696 697Defines the APN information. 698 699**System capability**: SystemCapability.Telephony.CellularData 700 701| Name | Type | Read-Only | Optional | Description | 702|------------|----------|---------|------------|-------------| 703| apnName | string | No | No | APN name. | 704| apn | string | No | No | APN. | 705| mcc | string | No | No | Mobile country code (MCC) of the SIM card.| 706| mnc | string | No | No | Mobile network code (MNC) of the SIM card.| 707| user | string | No | Yes | User name. | 708| type | string | No | Yes | APN type. | 709| proxy | string | No | Yes | Proxy address. | 710| mmsproxy | string | No | Yes | Multimedia messaging service (MMS) proxy. | 711