Network Data and Metrics

Methods mentioned in this section call upon the relevant methods on Android's TelephonyManager class.

Check Android Develop Docs for more details on how these methods function.

isSmsCapable

Returns Future<bool>

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

bool isSmsCapable = await telephony.isSmsCapable;

cellularDataState

Returns Future<DataState>

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

DataState state = await telephony.cellularDataState;

callState

Returns Future<CallState>

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

CallState state = await telephony.callState;

dataActivity

Returns Future<DataActivity>

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

DataActivity activity = await telephony.dataActivity;

networkOperator

Returns Future<String>

Returns the numeric name (MCC+MNC) of current registered operator.

Availability: Only when user is registered to a network.

Result may be unreliable on CDMA networks (use phoneType to determine if on a CDMA network).

String networkOperator = await telephony.networkOperator;

networkOperatorName

Returns Future<String>

Returns the alphabetic name of current registered operator.

Availability: Only when user is registered to a network.

Result may be unreliable on CDMA networks (use phoneType to determine if on a CDMA network).

String operatorName = await telephony.networkOperatorName;

dataNetworkType

Returns Future<NetworkType>

Requires READ_PHONE_STATE permission.

Add the following in your AndroidManifest.xml

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

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

NetworkType type = await telephony.dataNetworkType;

phoneType

Returns Future<PhoneType>

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

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 must be SIM_STATE_READY

String simOperator = await telephony.simOperator;

simOperatorName

Returns Future<String>

Returns the Service Provider Name (SPN).

Availability: SimState must be SIM_STATE_READY

String simOperatorName = await telephony.simOperatorName;

simState

Returns Future<SimState>

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

SimState state = await telephony.simState;

isNetworkRoaming

Returns Future<bool>

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

Availability: Only when user registered to a network.

bool isNetworkRoaming = await telephony.isNetworkRoaming;

signalStrengths

Returns Future<List<SignalStrength>>

Requires Android build version 29 --> Android Q

Returns a List of SignalStrength or an empty List if there are no valid measurements.

List<SignalStrength> strenghts = await telephony.signalStrengths;

serviceState

Returns Future<ServiceState>

Requires Android build version 26 --> Android O

Requires permissions ACCESS_COARSE_LOCATION and READ_PHONE_STATE

Add the following in your AndroidManifest.xml

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

Returns current voice service state.

ServiceState state = await telephony.serviceState;

DataState

CallState

DataActivity

NetworkType

PhoneType

SimState

SignalStrength

ServiceState

Last updated