SmsManager Class

Definition

Manages SMS operations such as sending data, text, and pdu SMS messages.

[Android.Runtime.Register("android/telephony/SmsManager", DoNotGenerateAcw=true)]
public sealed class SmsManager : Java.Lang.Object
[<Android.Runtime.Register("android/telephony/SmsManager", DoNotGenerateAcw=true)>]
type SmsManager = class
    inherit Object
Inheritance
SmsManager
Attributes

Remarks

Manages SMS operations such as sending data, text, and pdu SMS messages. Get this object by calling the static method #getDefault(). To create an instance of SmsManager associated with a specific subscription ID, call #getSmsManagerForSubscriptionId(int). This is typically used for devices that support multiple active subscriptions at once.

For information about how to behave as the default SMS app on Android 4.4 (API level 19) and higher, see android.provider.Telephony.

Java documentation for android.telephony.SmsManager.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Fields

ExtraMmsData

Intent extra name for MMS sending result data in byte array type

ExtraMmsHttpStatus

Intent extra name for HTTP status code for MMS HTTP failure in integer type

MmsConfigAliasEnabled

Whether alias is enabled (boolean type)

MmsConfigAliasMaxChars

Max alias character count (int type)

MmsConfigAliasMinChars

Min alias character count (int type)

MmsConfigAllowAttachAudio

Whether audio is allowed to be attached for MMS messages (boolean type)

MmsConfigAppendTransactionId

Whether to append transaction id to MMS WAP Push M-Notification.

MmsConfigEmailGatewayNumber

Email gateway number (String type)

MmsConfigGroupMmsEnabled

Whether group MMS is enabled for the current carrier (boolean type)

MmsConfigHttpParams

A list of HTTP headers to add to MMS HTTP request, separated by "|" (String type)

MmsConfigHttpSocketTimeout

MMS HTTP socket timeout in milliseconds (int type)

MmsConfigMaxImageHeight

Max MMS image height (int type)

MmsConfigMaxImageWidth

Max MMS image width (int type)

MmsConfigMaxMessageSize

Max MMS message size in bytes (int type)

MmsConfigMessageTextMaxSize

Max message text size (int type)

MmsConfigMmsDeliveryReportEnabled

Whether MMS delivery report is enabled (boolean type)

MmsConfigMmsEnabled

Whether MMS is enabled for the current carrier (boolean type)

MmsConfigMmsReadReportEnabled

Whether MMS read report is enabled (boolean type)

MmsConfigMultipartSmsEnabled

Whether multipart SMS is enabled (boolean type)

MmsConfigNaiSuffix

The suffix to append to the NAI header value for MMS HTTP request (String type)

MmsConfigNotifyWapMmscEnabled

If this is enabled, M-NotifyResp.

MmsConfigRecipientLimit

Limit of recipients of MMS messages (int type)

MmsConfigSendMultipartSmsAsSeparateMessages

Whether multipart SMS should be sent as separate messages

MmsConfigShowCellBroadcastAppLinks

If true, show the cell broadcast (amber alert) in the SMS settings.

MmsConfigSmsDeliveryReportEnabled

Whether SMS delivery report is enabled (boolean type)

MmsConfigSmsToMmsTextLengthThreshold

Some carriers require SMS to be converted into MMS when text length reaches this threshold (int type)

MmsConfigSmsToMmsTextThreshold

When the number of parts of a multipart SMS reaches this threshold, it should be converted into an MMS (int type)

MmsConfigSubjectMaxLength

Max message subject length (int type)

MmsConfigSupportHttpCharsetHeader

Whether the carrier MMSC supports charset field in Content-Type header.

MmsConfigSupportMmsContentDisposition

Whether content-disposition field should be expected in an MMS PDU (boolean type)

MmsConfigUaProfTagName

The name of the UA Prof URL HTTP header for MMS HTTP request (String type)

MmsConfigUaProfUrl

The UA Profile URL header value for MMS HTTP request (String type)

MmsConfigUserAgent

The User-Agent header value for MMS HTTP request (String type)

MmsErrorDataDisabled
Obsolete.

Data is disabled for the MMS APN.

MmsErrorInactiveSubscription
Obsolete.

The subscription id for the send/download is inactive.

MmsErrorInvalidSubscriptionId
Obsolete.

The subscription id for the send/download is invalid.

ResultBluetoothDisconnected
Obsolete.

Failed sending via bluetooth because bluetooth disconnected

ResultCancelled
Obsolete.

Failed because the operation was cancelled

ResultEncodingError
Obsolete.

Failed because of an encoding error

ResultErrorFdnCheckFailure
Obsolete.

Failed because FDN is enabled.

ResultErrorNone
Obsolete.

No error.

ResultInternalError
Obsolete.

Failed because of an internal error

ResultInvalidArguments
Obsolete.

Failed because of invalid arguments

ResultInvalidBluetoothAddress
Obsolete.

Failed sending via bluetooth because the bluetooth device address is invalid

ResultInvalidSmscAddress
Obsolete.

Failed because of an invalid smsc address

ResultInvalidSmsFormat
Obsolete.

Failed because the sms format is not valid

ResultInvalidState
Obsolete.

Failed because of an invalid state

ResultModemError
Obsolete.

Failed because of a modem error

ResultNetworkError
Obsolete.

Failed because of a network error

ResultNetworkReject
Obsolete.

Failed because of network rejection

ResultNoBluetoothService
Obsolete.

Failed sending via bluetooth because the bluetooth service is not available

ResultNoDefaultSmsApp
Obsolete.

Set by BroadcastReceiver to indicate there's no default sms app.

ResultNoMemory
Obsolete.

Failed because there is no memory

ResultNoResources
Obsolete.

Failed because there are no resources

ResultOperationNotAllowed
Obsolete.

Failed because the operation is not allowed

ResultRadioNotAvailable
Obsolete.

Failed because the radio was not available

ResultReceiveDispatchFailure
Obsolete.

SMS receive dispatch failure.

ResultReceiveInjectedNullPdu
Obsolete.

SMS receive injected null PDU.

ResultReceiveNullMessageFromRil
Obsolete.

SMS received null message from the radio interface layer.

ResultReceiveRuntimeException
Obsolete.

SMS receive encountered runtime exception.

ResultReceiveSqlException
Obsolete.

SMS receive encountered an SQL exception.

ResultReceiveUriException
Obsolete.

SMS receive an exception parsing a uri.

ResultReceiveWhileEncrypted
Obsolete.

SMS short code received while the phone is in encrypted state.

ResultRemoteException
Obsolete.

Set by BroadcastReceiver to indicate a remote exception while handling a message.

ResultRequestNotSupported
Obsolete.

Failed because the request is not supported

ResultRilAborted
Obsolete.

Operation aborted

ResultRilAccessBarred
Obsolete.

Access is barred.

ResultRilBlockedDueToCall
Obsolete.

SMS is blocked due to call control, e.

ResultRilCancelled
Obsolete.

The request has been cancelled.

ResultRilDeviceInUse
Obsolete.

Operation cannot be performed because the device is currently in use

ResultRilEncodingErr
Obsolete.

The SMS message was not encoded properly.

ResultRilGenericError
Obsolete.

A RIL error occurred during the SMS send.

ResultRilInternalErr
Obsolete.

The modem encountered an unexpected error scenario while handling the request.

ResultRilInvalidArguments
Obsolete.

The radio received invalid arguments in the request.

ResultRilInvalidModemState
Obsolete.

The radio cannot process the request in the current modem state.

ResultRilInvalidResponse
Obsolete.

A RIL internal error when one of the RIL layers receives an unrecognized response from a lower layer.

ResultRilInvalidSimState
Obsolete.

Cannot process the request in current SIM state

ResultRilInvalidSmscAddress
Obsolete.

The specified SMSC address was invalid.

ResultRilInvalidSmsFormat
Obsolete.

The radio returned an error indicating invalid sms format.

ResultRilInvalidState
Obsolete.

The radio returned an unexpected request for the current state.

ResultRilModemErr
Obsolete.

The vendor RIL received an unexpected or incorrect response.

ResultRilNetworkErr
Obsolete.

The radio received an error from the network.

ResultRilNetworkNotReady
Obsolete.

The network is not ready to perform the request.

ResultRilNetworkReject
Obsolete.

The sms request was rejected by the network.

ResultRilNoMemory
Obsolete.

The radio didn't have sufficient memory to process the request.

ResultRilNoNetworkFound
Obsolete.

Network cannot be found

ResultRilNoResources
Obsolete.

There are insufficient resources to process the request.

ResultRilNoSmsToAck
Obsolete.

ACK received when there is no SMS to ack

ResultRilNoSubscription
Obsolete.

Device does not have subscription

ResultRilOperationNotAllowed
Obsolete.

The radio reports the request is not allowed.

ResultRilRadioNotAvailable
Obsolete.

The radio did not start or is resetting.

ResultRilRequestNotSupported
Obsolete.

The request was not supported by the radio.

ResultRilRequestRateLimited
Obsolete.

The radio denied the operation due to overly-frequent requests.

ResultRilSimAbsent
Obsolete.

The radio failed to set the location where the CDMA subscription can be retrieved because the SIM or RUIM is absent.

ResultRilSimBusy
Obsolete.

SIM is busy

ResultRilSimError
Obsolete.

Received error from SIM card

ResultRilSimFull
Obsolete.

The target EF is full

ResultRilSimPin2
Obsolete.

Operation requires SIM PIN2 to be entered

ResultRilSimPuk2
Obsolete.

Operation requires SIM PUK2 to be entered

ResultRilSimultaneousSmsAndCallNotAllowed
Obsolete.

1X voice and SMS are not allowed simultaneously.

ResultRilSmsSendFailRetry
Obsolete.

The radio failed to send the sms and needs to retry.

ResultRilSubscriptionNotAvailable
Obsolete.

Fail to find CDMA subscription from specified location

ResultRilSystemErr
Obsolete.

The radio encountered a platform or system error.

ResultSmsBlockedDuringEmergency
Obsolete.

Failed sending during an emergency call

ResultSmsSendRetryFailed
Obsolete.

Failed to send an sms retry

ResultSystemError
Obsolete.

Failed because of a system error

ResultUnexpectedEventStopSending
Obsolete.

Failed sending because the user denied or canceled the dialog displayed for a premium shortcode sms or rate-limited sms.

ResultUserNotAllowed
Obsolete.

User is not associated with the subscription.

SmsRpCauseCallBarring
Obsolete.

RP-Cause Value for Call Barring

SmsRpCauseCongestion
Obsolete.

RP-Cause Value for SMS Failure due to Congestion in network

SmsRpCauseDestinationOutOfOrder
Obsolete.

RP-Cause Value for Destination is Out of Order

SmsRpCauseFacilityNotImplemented
Obsolete.

RP-Cause Value when network does not provide the received service

SmsRpCauseFacilityNotSubscribed
Obsolete.

RP-Cause Value when SMS Facilty is not subscribed by Reote device

SmsRpCauseFacilityRejected
Obsolete.

RP-Cause Value when SMS Facility if Rejected by Operator

SmsRpCauseInformationElementNonExistent
Obsolete.

RP-Cause Value when network does not provide the received service

SmsRpCauseInterworkingUnspecified
Obsolete.

RP-Cause Value when network does not provide the received service

SmsRpCauseInvalidMandatoryInformation
Obsolete.

RP-Cause Value when network does not provide the received service

SmsRpCauseInvalidMessageReferenceValue
Obsolete.

RP-Cause Value when RP-MessageRefere

SmsRpCauseMessageIncompatibleWithProtocolState
Obsolete.

RP-Cause Value when network does not provide the received service

SmsRpCauseMessageTypeNonExistent
Obsolete.

RP-Cause Value when network does not provide the received service

SmsRpCauseNetworkOutOfOrder
Obsolete.

RP-Cause Value when network is out of order

SmsRpCauseOperatorDeterminedBarring
Obsolete.

RP-Cause for Operator Barring

SmsRpCauseProtocolError
Obsolete.

RP-Cause Value when network does not provide the received service

SmsRpCauseReserved
Obsolete.

RP-Cause value for Reserved Number

SmsRpCauseResourcesUnavailable
Obsolete.

RP-Cause Value when Network Resources are unavailable

SmsRpCauseSemanticallyIncorrectMessage
Obsolete.

RP-Cause Value when network does not provide the received service

SmsRpCauseShortMessageTransferRejected
Obsolete.

RP-Cause Value for Message Transfer Rejected by Network

SmsRpCauseTemporaryFailure
Obsolete.

RP-Cause Value For Temporary failure

SmsRpCauseUnallocatedNumber
Obsolete.

Unallocated Number Cause

SmsRpCauseUnidentifiedSubscriber
Obsolete.

RP-Cause Value when Subscriber is not Identified

SmsRpCauseUnknownSubscriber
Obsolete.

RP-Cause Value when Subscriber is not Identified

Properties

CarrierConfigValues

Get carrier-dependent MMS configuration values.

Class

Returns the runtime class of this Object.

(Inherited from Object)
Default

Get the SmsManager associated with the default subscription id.

DefaultSmsSubscriptionId

Get default sms subscription id.

Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
SmscAddress

Gets the SMSC address from (U)SIM.

SmsCapacityOnIcc

Gets the total capacity of SMS storage on the SIM card.

SubscriptionId

Get the associated subscription id.

ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)
ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)

Methods

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
CreateAppSpecificSmsToken(PendingIntent)

Create a single use app specific incoming SMS request for the calling package.

CreateAppSpecificSmsTokenWithPackageInfo(String, PendingIntent)

Create a single use app specific incoming SMS request for the calling package.

CreateForSubscriptionId(Int32)

Get the instance of the SmsManager associated with a particular subscription ID.

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
DivideMessage(String)

Divide a message text into several fragments, none bigger than the maximum SMS message size.

DownloadMultimediaMessage(Context, String, Uri, Bundle, PendingIntent)

Download an MMS message from carrier by a given location URL

        &lt;p class="note"&gt;&lt;strong&gt;Note:&lt;/strong&gt; If <code data-dev-comment-type="c">#getDefault()</code> is used to instantiate this
        manager on a multi-SIM device, this operation may fail downloading the MMS message because no
        suitable default subscription could be found.
DownloadMultimediaMessage(Context, String, Uri, Bundle, PendingIntent, Int64)

Download an MMS message from carrier by a given location URL

        Same as <code data-dev-comment-type="c">#downloadMultimediaMessage(Context context, String locationUrl,
             Uri contentUri, Bundle configOverrides, PendingIntent downloadedIntent)</code>,
             but adds an optional messageId.
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetSmsManagerForSubscriptionId(Int32)

Get the instance of the SmsManager associated with a particular subscription ID.

GetSmsMessagesForFinancialApp(Bundle, IExecutor, SmsManager+FinancialSmsCallback)

Get SMS messages for the calling financial app.

InjectSmsPdu(Byte[], String, PendingIntent)

Inject an SMS PDU into the android application framework.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
SendDataMessage(String, String, Int16, Byte[], PendingIntent, PendingIntent)

Send a data based SMS to a specific application port.

SendMultimediaMessage(Context, Uri, String, Bundle, PendingIntent)

Send an MMS message

        &lt;p class="note"&gt;&lt;strong&gt;Note:&lt;/strong&gt; If <code data-dev-comment-type="c">#getDefault()</code> is used to instantiate this
        manager on a multi-SIM device, this operation may fail sending the MMS message because no
        suitable default subscription could be found.
SendMultimediaMessage(Context, Uri, String, Bundle, PendingIntent, Int64)

Send an MMS message

        Same as <code data-dev-comment-type="c">#sendMultimediaMessage(Context context, Uri contentUri, String locationUrl,
                  Bundle configOverrides, PendingIntent sentIntent)</code>, but adds an optional messageId.
SendMultipartTextMessage(String, String, IList<String>, IList<PendingIntent>, IList<PendingIntent>)

Send a multi-part text based SMS.

SendMultipartTextMessage(String, String, IList<String>, IList<PendingIntent>, IList<PendingIntent>, Int64)

Send a multi-part text based SMS.

SendMultipartTextMessage(String, String, IList<String>, IList<PendingIntent>, IList<PendingIntent>, String, String)

Similar method as #sendMultipartTextMessage(String, String, ArrayList, ArrayList, ArrayList) With an additional argument.

SendTextMessage(String, String, String, PendingIntent, PendingIntent)

Send a text based SMS.

SendTextMessage(String, String, String, PendingIntent, PendingIntent, Int64)

Send a text based SMS.

SendTextMessageWithoutPersisting(String, String, String, PendingIntent, PendingIntent)

Send a text based SMS without writing it into the SMS Provider.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetSmscAddress(String)

Sets the SMSC address on (U)SIM.

ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to