Telephony class

A Flutter plugin to use telephony features such as

  • Send SMS Messages
  • Query SMS Messages
  • Listen for incoming SMS
  • Retrieve various network parameters

This plugin tries to replicate some of the functionality provided by Android's Telephony class.

Constructors

Telephony.private(MethodChannel methodChannel, Platform platform)
Do not call this method. This method is visible only for testing.

Properties

callState Future<CallState>
Returns a constant that represents the current state of all phone calls.
no setter
cellularDataState Future<DataState>
Returns a constant indicating the current data connection state (cellular).
no setter
dataActivity Future<DataActivity>
Returns a constant that represents the current state of all phone calls.
no setter
dataNetworkType Future<NetworkType>
Returns a constant indicating the radio technology (network type) currently in use on the device for data transmission.
no setter
hashCode int
The hash code for this object.
no setterinherited
isNetworkRoaming Future<bool?>
Returns true if the device is considered roaming on the current network, for GSM purposes.
no setter
isSmsCapable Future<bool?>
Checks if the device has necessary features to send and receive SMS.
no setter
networkOperator Future<String?>
Returns the numeric name (MCC+MNC) of current registered operator.
no setter
networkOperatorName Future<String?>
Returns the alphabetic name of current registered operator.
no setter
phoneType Future<PhoneType>
Returns a constant indicating the device phone type. This indicates the type of radio used to transmit voice calls.
no setter
requestPhoneAndSmsPermissions Future<bool?>
Request the user for all the phone and sms permissions listed in the app's AndroidManifest.xml
no setter
requestPhonePermissions Future<bool?>
Request the user for all the phone permissions listed in the app's AndroidManifest.xml
no setter
requestSmsPermissions Future<bool?>
Request the user for all the sms permissions listed in the app's AndroidManifest.xml
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
serviceState Future<ServiceState>
Returns current voice service state.
no setter
signalStrengths Future<List<SignalStrength>>
Returns a List of SignalStrength or an empty List if there are no valid measurements.
no setter
simOperator Future<String?>
Returns the MCC+MNC (mobile country code + mobile network code) of the provider of the SIM. 5 or 6 decimal digits.
no setter
simOperatorName Future<String?>
Returns the Service Provider Name (SPN).
no setter
simState Future<SimState>
Returns a constant indicating the state of the default SIM card.
no setter

Methods

dialPhoneNumber(String phoneNumber) Future<void>
Starts a phone all with the given phone number.
getConversations({ConversationFilter? filter, List<OrderBy>? sortOrder}) Future<List<SmsConversation>>
Query SMS Inbox.
getDraftSms({List<SmsColumn> columns = DEFAULT_SMS_COLUMNS, SmsFilter? filter, List<OrderBy>? sortOrder}) Future<List<SmsMessage>>
Query SMS Drafts.
getInboxSms({List<SmsColumn> columns = DEFAULT_SMS_COLUMNS, SmsFilter? filter, List<OrderBy>? sortOrder}) Future<List<SmsMessage>>
Query SMS Inbox.
getSentSms({List<SmsColumn> columns = DEFAULT_SMS_COLUMNS, SmsFilter? filter, List<OrderBy>? sortOrder}) Future<List<SmsMessage>>
Query SMS Outbox / Sent messages.
handler(MethodCall call) Future
Do not call this method. This method is visible only for testing.
listenIncomingSms({required MessageHandler onNewMessage, MessageHandler? onBackgroundMessage, bool listenInBackground = true}) → void
Listens to incoming SMS.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
openDialer(String phoneNumber) Future<void>
Opens the default dialer with the given phone number.
sendSms({required String to, required String message, SmsSendStatusListener? statusListener, bool isMultipart = false}) Future<void>
Send an SMS directly from your application. Uses Android's SmsManager to send SMS.
sendSmsByDefaultApp({required String to, required String message}) Future<void>
Open Android's default SMS application with the provided message and address.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

backgroundInstance Telephony
Gets a singleton instance of the Telephony class to be used in background execution context.
no setter
instance Telephony
Gets a singleton instance of the Telephony class.
no setter