Network Data and Metrics
Methods mentioned in this section call upon the relevant methods on Android's
TelephonyManager
class. Returns Future<bool>
Checks if the device has necessary features to send and receive SMS.
bool isSmsCapable = await telephony.isSmsCapable;
Returns a constant indicating the current data connection state (cellular).
DataState state = await telephony.cellularDataState;
Returns a constant that represents the current state of all phone calls.
CallState state = await telephony.callState;
Returns a constant indicating the type of activity on a data connection (cellular).
DataActivity activity = await telephony.dataActivity;
Returns Future<String>
Returns the numeric name (MCC+MNC) of current registered operator.
Availability: Only when user is registered to a network.
String networkOperator = await telephony.networkOperator;
Returns Future<String>
Returns the alphabetic name of current registered operator.
Availability: Only when user is registered to a network.
String operatorName = await telephony.networkOperatorName;
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;
Returns a constant indicating the device phone type. This indicates the type of radio used to transmit voice calls.
PhoneType type = await telephony.phoneType;
Returns Future<String>
Returns the MCC+MNC (mobile country code + mobile network code) of the provider of the SIM. 5 or 6 decimal digits.
String simOperator = await telephony.simOperator;
Returns Future<String>
Returns the Service Provider Name (SPN).
String simOperatorName = await telephony.simOperatorName;
Returns a constant indicating the state of the default SIM card.
SimState state = await telephony.simState;
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;
Requires Android build version 29 --> Android Q
List<SignalStrength> strenghts = await telephony.signalStrengths;
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;
Values |
DISCONNECTED |
CONNECTING |
CONNECTED |
SUSPENDED |
UNKNOWN |
Values |
IDLE |
RINGING |
OFFHOOK |
Values |
NONE |
IN |
OUT |
INOUT |
DORMANT |
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 |
Values |
NONE |
GSM |
CDMS |
SIP |
Values |
UNKNOWN |
ABSENT |
PIN_REQUIRED |
PUK_REQUIRED |
NETWORK_LOCKED |
READY |
NOT_READY |
PERM_DISABLED |
CARD_IO_ERROR |
CARD_RESTRICTED |
LOADED |
PRESENT |
Values |
NONE_OR_UNKNOWN |
POOR |
MODERATE |
GOOD |
GREAT |
Values |
IN_SERVICE |
OUT_OF_SERVICE |
EMERGENCY_ONLY |
POWER_OFF |
Last modified 2yr ago