# Network Data and Metrics

{% hint style="info" %}
**Methods mentioned in this section call upon the relevant methods on Android's** [**`TelephonyManager`**](https://developer.android.com/reference/android/telephony/TelephonyManager) **class.**&#x20;

**Check** [**Android Develop Docs**](https://developer.android.com/reference/android/telephony/TelephonyManager) **for more details on how these methods function.**
{% endhint %}

## isSmsCapable

**Returns Future\<bool>**

Checks if the device has necessary features to send and receive SMS.

```dart
bool isSmsCapable = await telephony.isSmsCapable;
```

## cellularDataState

**Returns Future<**[**DataState**](/network-data-and-metrics.md#datastate)**>**

Returns a constant indicating the current data connection state (cellular).

```dart
DataState state = await telephony.cellularDataState;
```

## callState

**Returns Future<**[**CallState**](/network-data-and-metrics.md#callstate-1)**>**

Returns a constant that represents the current state of all phone calls.

```dart
CallState state = await telephony.callState;
```

## dataActivity

**Returns Future<**[**DataActivity**](/network-data-and-metrics.md#dataactivity-1)**>**

Returns a constant indicating the type of activity on a data connection (cellular)**.**

```dart
DataActivity activity = await telephony.dataActivity;
```

## networkOperator

**Returns Future\<String>**

Returns the numeric name (MCC+MNC) of current registered operator.&#x20;

Availability: Only when user is registered to a network.&#x20;

Result may be unreliable on CDMA networks (use [phoneType](/network-data-and-metrics.md#phonetype) to determine if on a CDMA network).

```dart
String networkOperator = await telephony.networkOperator;
```

## networkOperatorName

**Returns Future\<String>**

Returns the alphabetic name of current registered operator.&#x20;

Availability: Only when user is registered to a network.&#x20;

Result may be unreliable on CDMA networks (use [phoneType](/network-data-and-metrics.md#phonetype) to determine if on a CDMA network).

```dart
String operatorName = await telephony.networkOperatorName;
```

## dataNetworkType

**Returns Future<**[**NetworkType**](/network-data-and-metrics.md#networktype)**>**

{% hint style="danger" %}
**Requires `READ_PHONE_STATE` permission.**

Add the following in your `AndroidManifest.xml`

```markup
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
```

{% endhint %}

Returns a constant indicating the radio technology (network type) currently in use on the device for data transmission.

```dart
NetworkType type = await telephony.dataNetworkType;
```

## phoneType

**Returns Future<**[**PhoneType**](/network-data-and-metrics.md#phonetype-1)**>**

Returns a constant indicating the device phone type. This indicates the type of radio used to transmit voice calls.

```dart
PhoneType type = await telephony.phoneType;
```

## simOperator

**Returns Future\<String>**

Returns the MCC+MNC (mobile country code + mobile network code) of the provider of the SIM. 5 or 6 decimal digits.

Availability: [SimState ](/network-data-and-metrics.md#simstate)must be SIM\_STATE\_READY

```dart
String simOperator = await telephony.simOperator;
```

## simOperatorName

**Returns Future\<String>**

Returns the Service Provider Name (SPN).&#x20;

Availability: [SimState ](/network-data-and-metrics.md#simstate)must be SIM\_STATE\_READY

```dart
String simOperatorName = await telephony.simOperatorName;
```

## simState

**Returns Future<**[**SimState**](/network-data-and-metrics.md#simstate-1)**>**

Returns a constant indicating the state of the default SIM card.

```dart
SimState state = await telephony.simState;
```

## isNetworkRoaming

**Returns Future\<bool>**

Returns true if the device is considered roaming on the current network, for GSM purposes.&#x20;

Availability: Only when user registered to a network.

```dart
bool isNetworkRoaming = await telephony.isNetworkRoaming;
```

## signalStrengths

**Returns Future\<List<**[**SignalStrength**](/network-data-and-metrics.md#signalstrength)**>>**

{% hint style="danger" %}
**Requires Android build version 29 --> Android Q**
{% endhint %}

Returns a List of [SignalStrength](/network-data-and-metrics.md#signalstrength) or an empty List if there are no valid measurements.

```dart
List<SignalStrength> strenghts = await telephony.signalStrengths;
```

## serviceState

**Returns Future<**[**ServiceState**](/network-data-and-metrics.md#servicestate-1)**>**

{% hint style="danger" %}
**Requires Android build version 26 --> Android O**

**Requires permissions `ACCESS_COARSE_LOCATION` and `READ_PHONE_STATE`**

Add the following in your `AndroidManifest.xml`

```markup
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
```

{% endhint %}

Returns current voice service stat&#x65;**.**

```dart
ServiceState state = await telephony.serviceState;
```

## DataState

| Values             |
| ------------------ |
| **`DISCONNECTED`** |
| **`CONNECTING`**   |
| **`CONNECTED`**    |
| **`SUSPENDED`**    |
| **`UNKNOWN`**      |

## CallState

| Values        |
| ------------- |
| **`IDLE`**    |
| **`RINGING`** |
| **`OFFHOOK`** |

## DataActivity

| Values        |
| ------------- |
| **`NONE`**    |
| **`IN`**      |
| **`OUT`**     |
| **`INOUT`**   |
| **`DORMANT`** |

## NetworkType

| Values           |
| ---------------- |
| **`UNKNOWN`**    |
| **`GPRS`**       |
| **`EDGE`**       |
| **`UMTS`**       |
| **`CDMA`**       |
| **`EVDO_0`**     |
| **`EVDO_A`**     |
| **`TYPE_1xRTT`** |
| **`HSDPA`**      |
| **`HSUPA`**      |
| **`HSPA`**       |
| **`IDEN`**       |
| **`EVDO_B`**     |
| **`LTE`**        |
| **`EHRPD`**      |
| **`HSPAP`**      |
| **`GSM`**        |
| **`TD_SCDMA`**   |
| **`IWLAN`**      |
| **`LTE_CA`**     |
| **`NR`**         |

## PhoneType

| Values     |
| ---------- |
| **`NONE`** |
| **`GSM`**  |
| **`CDMS`** |
| **`SIP`**  |

## SimState

| Values                |
| --------------------- |
| **`UNKNOWN`**         |
| **`ABSENT`**          |
| **`PIN_REQUIRED`**    |
| **`PUK_REQUIRED`**    |
| **`NETWORK_LOCKED`**  |
| **`READY`**           |
| **`NOT_READY`**       |
| **`PERM_DISABLED`**   |
| **`CARD_IO_ERROR`**   |
| **`CARD_RESTRICTED`** |
| **`LOADED`**          |
| **`PRESENT`**         |

## **SignalStrength**

| Values                |
| --------------------- |
| **`NONE_OR_UNKNOWN`** |
| **`POOR`**            |
| **`MODERATE`**        |
| **`GOOD`**            |
| **`GREAT`**           |

## **ServiceState**

| Values               |
| -------------------- |
| **`IN_SERVICE`**     |
| **`OUT_OF_SERVICE`** |
| **`EMERGENCY_ONLY`** |
| **`POWER_OFF`**      |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://telephony.shounakmulay.dev/network-data-and-metrics.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
