The network connection management module provides basic network management capabilities. You can obtain the default active data network or the list of all active data networks, enable or disable the airplane mode, and obtain network capability information.
> **NOTE**
>
...
...
@@ -79,7 +80,7 @@ Checks whether the default data network is activated. This API uses an asynchron
```js
connection.hasDefaultNet(function(error,has){
console.log(JSON.stringify(error))
console.log(has)
console.log('has: '+has)
})
```
...
...
@@ -101,7 +102,7 @@ Checks whether the default data network is activated. This API uses a promise to
```js
connection.hasDefaultNet().then(function(has){
console.log(has)
console.log('has: '+has)
})
```
...
...
@@ -167,7 +168,7 @@ Obtains connection properties of the network corresponding to given network hand
| type | string | Yes | Event type. The value is fixed to **netCapabilitiesChange**.<br>**netCapabilitiesChange**: event indicating that he network capabilities have changed.|
| type | string | Yes | Event type. The value is fixed at **netCapabilitiesChange**.<br>**netCapabilitiesChange**: event indicating that network capabilities have changed.|
| callback | Callback<{netHandle:[NetHandle](#nethandle),netCap:[NetCapabilities](#netcapabilities)}> | Yes | Callback used to return the result. |
**Example**
...
...
@@ -543,7 +643,7 @@ Registers a listener for **netConnectionPropertiesChange** events.
| type | string | Yes | Event type. The value is fixed to**netConnectionPropertiesChange**.<br>**netConnectionPropertiesChange**: event indicating that network connection properties have changed.|
| type | string | Yes | Event type. The value is fixed at**netConnectionPropertiesChange**.<br>**netConnectionPropertiesChange**: event indicating that network connection properties have changed.|
| callback | Callback<{netHandle:[NetHandle](#nethandle),connectionProperties:[ConnectionProperties](#connectionproperties)}> | Yes | Callback used to return the result. |
**Example**
...
...
@@ -566,7 +666,7 @@ Registers a listener for **netBlockStatusChange** events.
| type | string | Yes | Event type. The value is fixed to**netBlockStatusChange**.<br>**netBlockStatusChange**: event indicating a change in the network blocking status.|
| type | string | Yes | Event type. The value is fixed at**netBlockStatusChange**.<br>**netBlockStatusChange**: event indicating a change in the network blocking status.|
| callback | Callback<{ netHandle: [NetHandle](#nethandle), blocked: boolean }> | Yes | Callback used to return the result. |
**Example**
...
...
@@ -589,7 +689,7 @@ Registers a listener for **netLost** events.
| type | string | Yes | Event type. The value is fixed to**netLost**.<br>netLost: event indicating that the network is interrupted or normally disconnected.|
| type | string | Yes | Event type. The value is fixed at**netLost**.<br>netLost: event indicating that the network is interrupted or normally disconnected.|
| callback | Callback\<[NetHandle](#nethandle)> | Yes | Callback used to return the result. |
**Example**
...
...
@@ -613,7 +713,7 @@ Registers a listener for **netUnavailable** events.
The observer module provides event subscription management functions. You can register or unregister an observer that listens for the following events: network status change, signal status change, call status change, cellular data connection status, uplink and downlink data flow status of cellular data services, and SIM status change.
>**NOTE**
>
>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.
...
...
@@ -15,7 +17,7 @@ import observer from '@ohos.telephony.observer'
@@ -41,7 +43,7 @@ observer.on('networkStateChange', data =>{
on\(type: \'networkStateChange\', options: { slotId: number }, callback: Callback<NetworkState\>\): void;
Registers an observer for network status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the execution result.
Registers an observer for network status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
@@ -125,7 +125,7 @@ observer.on('signalInfoChange', data =>{
on\(type: \'signalInfoChange\', options: { slotId: number }, callback: Callback<Array<SignalInformation\>\>): void;
Registers an observer for signal status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the execution result.
Registers an observer for signal status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
| type | string | Yes | Connection status change event of the cellular data link. |
| type | string | Yes | Connection status change event of the cellular data connection. |
| callback | Callback\<{ state: [DataConnectState](js-apis-telephony-data.md#dataconnectstate), network: [RatType](js-apis-radio.md#radiotechnology) }\> | Yes | Callback used to return the result. For details, see [DataConnectState](js-apis-telephony-data.md#dataconnectstate) and [RadioTechnology](js-apis-radio.md#radiotechnology).|
**Example**
...
...
@@ -293,7 +287,7 @@ observer.on('cellularDataConnectionStateChange', value =>{
Registers an observer for connection status change events of the cellular data link over the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
Registers an observer for connection status change events of the cellular data connection over the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
| callback | Callback\<{ state: [DataConnectState](js-apis-telephony-data.md#dataconnectstate), network: [RatType](js-apis-radio.md#radiotechnology) }\> | Yes | Callback used to return the result. For details, see [DataConnectState](js-apis-telephony-data.md#dataconnectstate) and [RadioTechnology](js-apis-radio.md#radiotechnology).|
...
...
@@ -318,7 +312,7 @@ observer.on('cellularDataConnectionStateChange', {slotId: 0}, value =>{
Unregisters the observer for connection status change events of the cellular data link. This API uses an asynchronous callback to return the result.
Unregisters the observer for connection status change events of the cellular data connection.This API uses an asynchronous callback to return the result.
>**NOTE**
>
...
...
@@ -330,7 +324,7 @@ Unregisters the observer for connection status change events of the cellular dat
| type | string | Yes | Connection status change event of the cellular data link. |
| type | string | Yes | Connection status change event of the cellular data connection. |
| callback | Callback\<{ state: [DataConnectState](js-apis-telephony-data.md#dataconnectstate), network: [RatType](js-apis-radio.md#radiotechnology) }\> | No | Callback used to return the result. For details, see [DataConnectState](js-apis-telephony-data.md#dataconnectstate) and [RadioTechnology](js-apis-radio.md#radiotechnology).|
The 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.
>**NOTE**
>
>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.
...
...
@@ -15,7 +17,7 @@ import radio from '@ohos.telephony.radio'
Obtains the radio access technology (RAT) used by the CS and PS domains for the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
Obtains 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.
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.|
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. |
The SIM management module provides basic SIM card management functions. You can obtain the name, number, ISO country code, home PLMN number, service provider name, SIM card status, type, installation status, activation status, and lock status of the SIM card in the specified slot. Besides, you can set the name, number, and lock status of the SIM card, activate or deactivate the SIM card, and change the PIN or unlock the PIN or PUK of the SIM card.
>**NOTE**
>
>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.
| callback | AsyncCallback\<[IccAccountInfo](#IccAccountInfo7)\> | Yes | Callback used to return the result. For details, see [IccAccountInfo](#IccAccountInfo7).|
| callback | AsyncCallback\<[IccAccountInfo](#IccAccountInfo7)\> | Yes | Callback used to return the result. |
The SMS module provides basic SMS management functions. You can create and send SMS messages, and obtain and set the default SIM card for sending and receiving SMS messages. Besides, you can obtain and set the SMSC address, and check whether the current device can send and receive SMS messages.
>**NOTE**
>
>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.
The cellular data module provides basic mobile data management functions. You can obtain and set the default slot of the SIM card used for mobile data, and obtain the uplink and downlink connection status of cellular data services and connection status of the packet switched (PS) domain. Besides, you can check whether cellular data services and data roaming are enabled.
>**NOTE**
>
>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.
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object. |
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. |