Lenguaje

SmsManager.SendTextMessage Método

Definición

Sobrecargas

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

Enviar un SMS basado en texto.

[Android.Runtime.Register("sendTextMessage", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Landroid/app/PendingIntent;Landroid/app/PendingIntent;J)V", "", ApiSince=30)]
public void SendTextMessage(string destinationAddress, string? scAddress, string text, Android.App.PendingIntent? sentIntent, Android.App.PendingIntent? deliveryIntent, long messageId);
[<Android.Runtime.Register("sendTextMessage", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Landroid/app/PendingIntent;Landroid/app/PendingIntent;J)V", "", ApiSince=30)>]
member this.SendTextMessage : string * string * string * Android.App.PendingIntent * Android.App.PendingIntent * int64 -> unit

Parámetros

destinationAddress
String

dirección a la que se va a enviar el mensaje

scAddress
String

es la dirección del centro de servicio o null para usar el SMSC predeterminado actual.

text
String

el cuerpo del mensaje que se va a enviar

sentIntent
PendingIntent

si no es NULL, este <código>PendingIntent</code> se transmite cuando el mensaje se envía correctamente o se produce un error. El código de resultado será <código>Activity.RESULT_OK</código> para éxito, o uno de estos errores:<br<>code>RESULT_ERROR_GENERIC_FAILURE</><code br>><code RESULT_ERROR_RADIO_OFF</code><br><code>RESULT_ERROR_NULL_PDU</code><br><code RESULT_ERROR_NO_SERVICE</code br code>RESULT_ERROR_LIMIT_EXCEEDED/code><br><code>RESULT_ERROR_LIMIT_EXCEEDED</code><br code>><<RESULT_ERROR_FDN_CHECK_FAILURE/código><br<>código>br RESULT_ERROR_SHORT_CODE_NOT_ALLOWED</<>><código br código>< RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED/><código br>><< RESULT_RADIO_NOT_AVAILABLE/><código br><>código br RESULT_NETWORK_REJECT</código><br><código>RESULT_INVALID_ARGUMENTS/código><br código>br RESULT_INVALID_STATE<</código br><><br><code RESULT_NO_MEMORY</code><br><code>RESULT_INVALID_SMS_FORMAT</code>><<br code>RESULT_SYSTEM_ERROR</><code br><>code RESULT_MODEM_ERROR</><code br><>code RESULT_NETWORK_ERROR</code><br><code>RESULT_ENCODING_ERROR</code><br<>code RESULT_INVALID_SMSC_ADDRESS</code><br code>><>><RESULT_OPERATION_NOT_ALLOWED/code><br><code>RESULT_INTERNAL_ERROR</code><<>br code>RESULT_NO_RESOURCES</><code br>><code RESULT_CANCELLED</><code br><>code RESULT_REQUEST_NOT_SUPPORTED</code><br<>code>RESULT_NO_BLUETOOTH_SERVICE</code><br code>br><code RESULT_INVALID_BLUETOOTH_ADDRESS</code><br><code>RESULT_BLUETOOTH_DISCONNECTED</code><br><code>RESULT_UNEXPECTED_EVENT_STOP_SENDING</code><br<>code>RESULT_SMS_BLOCKED_DURING_EMERGENCY</><code br>><code RESULT_SMS_SEND_RETRY_FAILED</><code br><code>RESULT_REMOTE_EXCEPTION</code><br><code RESULT_NO_DEFAULT_SMS_> Código< de código br><>RESULT_RIL_RADIO_NOT_AVAILABLE</<><>código br RESULT_RIL_SMS_SEND_FAIL_RETRY></código><br<>>< código br RESULT_RIL_NETWORK_REJECT/><código br>><código RESULT_RIL_INVALID_STATE</><código br<>código>br RESULT_RIL_INVALID_ARGUMENTS</código><br código>br RESULT_RIL_NO_MEMORY</código br><><><br><code RESULT_RIL_REQUEST_RATE_LIMITED</code><br<>code>RESULT_RIL_INVALID_SMS_FORMAT</code><><br code>RESULT_RIL_SYSTEM_ERR</><code br<>>code RESULT_RIL_ENCODING_ERR</><code br<>>code RESULT_RIL_INVALID_SMSC_ADDRESS</code><br><code RESULT_RIL_MODEM_ERR/code><br code>>br RESULT_<><><RIL_NETWORK_ERR/code><br><code>RESULT_RIL_INTERNAL_ERR</code><br<>code>RESULT_RIL_REQUEST_NOT_SUPPORTED</><code br><>code RESULT_RIL_INVALID_MODEM_STATE</><code br><>code RESULT_RIL_NETWORK_NOT_READY</code><br><code>RESULT_RIL_OPERATION_NOT_ALLOWED</code><br code RESULT_RIL_NO_><> RESOURCES</code><br><code>RESULT_RIL_CANCELLED</code><br><code>RESULT_RIL_SIM_ABSENT</code><br<>code>RESULT_RIL_SIMULTANEOUS_SMS_AND_CALL_NOT_ALLOWED</><code br<>>code RESULT_RIL_ACCESS_BARRED</code><br><code>RESULT_RIL_BLOCKED_DUE_TO_CALL</code><br> For <code RESULT_ERROR_><GENERIC_FAILURE/código> o cualquiera de los errores de RESULT_RIL, sentIntent puede incluir el "errorCode" adicional que contiene un valor específico de tecnología de radio, generalmente solo útil para solucionar problemas.<br>

deliveryIntent
PendingIntent

si no es NULL, este <código>PendingIntent</code> se transmite cuando el mensaje se entrega al destinatario. La pdu sin procesar del informe de estado se encuentra en los datos extendidos ("pdu").

messageId
Int64

Identificador que identifica de forma única el mensaje solicitado que se va a enviar. Se usa con fines de registro y diagnóstico. El identificador puede ser 0.

Atributos

Comentarios

Enviar un SMS basado en texto. Igual que #sendTextMessage( String destinationAddress, String scAddress, String text, PendingIntent sentIntent, PendingIntent deliveryIntent), pero agrega un messageId opcional.

Java documentación para android.telephony.SmsManager.sendTextMessage(java.lang.String, java.lang.String, java.lang.String, android.app.PendingIntent, android.app.PendingIntent, long).

Las partes de esta página son modificaciones basadas en el trabajo creado y compartido por el Android y se usan según los términos descritos en creative Creative Commons 2.5 Attribution License.

Se aplica a

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

Enviar un SMS basado en texto.

[Android.Runtime.Register("sendTextMessage", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Landroid/app/PendingIntent;Landroid/app/PendingIntent;)V", "")]
public void SendTextMessage(string? destinationAddress, string? scAddress, string? text, Android.App.PendingIntent? sentIntent, Android.App.PendingIntent? deliveryIntent);
[<Android.Runtime.Register("sendTextMessage", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Landroid/app/PendingIntent;Landroid/app/PendingIntent;)V", "")>]
member this.SendTextMessage : string * string * string * Android.App.PendingIntent * Android.App.PendingIntent -> unit

Parámetros

destinationAddress
String

dirección a la que se va a enviar el mensaje

scAddress
String

es la dirección del centro de servicio o null para usar el SMSC predeterminado actual.

text
String

el cuerpo del mensaje que se va a enviar

sentIntent
PendingIntent

si no es NULL, se PendingIntent transmite cuando el mensaje se envía correctamente o se produce un error. El código de resultado será Activity.RESULT_OK para éxito, o uno de estos errores:br>RESULT_ERROR_SHORT_CODE_NOT_ALLOWED<RESULT_ERROR_NO_SERVICE<>RESULT_ERROR_LIMIT_EXCEEDED><>RESULT_ERROR_FDN_CHECK_FAILURE<><RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED><>RESULT_RADIO_NOT_AVAILABLE<>RESULT_ERROR_NULL_PDU<RESULT_NETWORK_REJECT>RESULT_INVALID_ARGUMENTS<RESULT_INVALID_STATE<>RESULT_NO_MEMORY>RESULT_MODEM_ERROR><<RESULT_SYSTEM_ERROR>><RESULT_INVALID_SMS_FORMAT>RESULT_NETWORK_ERROR<<<><RESULT_INVALID_SMSC_ADDRESSRESULT_ENCODING_ERROR<>><RESULT_OPERATION_NOT_ALLOWEDRESULT_ERROR_GENERIC_FAILURE>RESULT_ERROR_RADIO_OFF><<br>RESULT_INTERNAL_ERROR<>RESULT_CANCELLED><RESULT_RIL_NETWORK_REJECT><RESULT_REQUEST_NOT_SUPPORTED><RESULT_RIL_INVALID_STATE><RESULT_NO_BLUETOOTH_SERVICE><RESULT_RIL_INVALID_ARGUMENTS><RESULT_INVALID_BLUETOOTH_ADDRESS><RESULT_RIL_NO_MEMORY><RESULT_BLUETOOTH_DISCONNECTED><RESULT_RIL_REQUEST_RATE_LIMITED><RESULT_UNEXPECTED_EVENT_STOP_SENDING<RESULT_SMS_BLOCKED_DURING_EMERGENCYRESULT_RIL_ENCODING_ERR>><<<RESULT_RIL_SYSTEM_ERR>>>RESULT_SMS_SEND_RETRY_FAILEDRESULT_RIL_SMS_SEND_FAIL_RETRY<<<<>RESULT_RIL_INVALID_SMS_FORMAT>RESULT_RIL_RADIO_NOT_AVAILABLE><RESULT_NO_DEFAULT_SMS_APP<>>RESULT_NO_RESOURCES<RESULT_REMOTE_EXCEPTIONbr>RESULT_RIL_INVALID_SMSC_ADDRESS<RESULT_RIL_NO_RESOURCES><RESULT_RIL_BLOCKED_DUE_TO_CALL>RESULT_RIL_ACCESS_BARRED<<RESULT_RIL_SIMULTANEOUS_SMS_AND_CALL_NOT_ALLOWED>><RESULT_RIL_INTERNAL_ERR>><><>><>RESULT_RIL_SIM_ABSENT<<RESULT_RIL_NETWORK_ERR>RESULT_RIL_NETWORK_NOT_READY<>RESULT_RIL_REQUEST_NOT_SUPPORTED<<RESULT_RIL_INVALID_MODEM_STATERESULT_RIL_OPERATION_NOT_ALLOWEDRESULT_RIL_CANCELLED>br>RESULT_RIL_MODEM_ERR<Br Br For RESULT_ERROR_GENERIC_FAILURE o cualquiera de los errores de RESULT_RIL, el sentIntent puede incluir el extra "errorCode" que contiene un valor específico de tecnología de radio, generalmente sólo útil para solución de problemas.<br>

deliveryIntent
PendingIntent

si no es NULL, se PendingIntent transmite cuando el mensaje se entrega al destinatario. La pdu sin procesar del informe de estado se encuentra en los datos extendidos ("pdu").

Atributos

Excepciones

si destinationAddress o text están vacíos

Comentarios

Enviar un SMS basado en texto.

<strong>Note:</strong> Using this method require that your app has the android.Manifest.permission#SEND_SMS permission.

<strong>Note:</strong> Beginning with Android 4.4 (API level 19), if em>and only if<</em> an app is not selected as the default SMS app, the system writes automatically messages sent using this method to the SMS Provider (the default SMS app is always responsable de escribir sus mensajes enviados en el proveedor de SMS). Para obtener información sobre cómo comportarse como la aplicación SMS predeterminada, consulte android.provider.Telephony.

<nota fuerte>:</strong> Si #getDefault() se usa para crear instancias de este administrador en un dispositivo multi SIM, esta operación puede producir un error al enviar el mensaje SMS porque no se encontró ninguna suscripción predeterminada adecuada. En este caso, si sentIntent no es NULL, PendingIntent se enviará con un código RESULT_ERROR_GENERIC_FAILURE de error y una cadena "noDefault" adicional que contiene el valor truebooleano . Consulte #getDefault() para obtener más información sobre las condiciones en las que esta operación puede producir un error.

Java documentación para android.telephony.SmsManager.sendTextMessage(java.lang.String, java.lang.String, java.lang.String, android.app.PendingIntent, android.app.PendingIntent).

Las partes de esta página son modificaciones basadas en el trabajo creado y compartido por el Android y se usan según los términos descritos en creative Creative Commons 2.5 Attribution License.

Se aplica a