SmsManager.SendTextMessage Metodo

Definizione

Overload

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

Inviare un SMS basato su testo.

[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

Parametri

destinationAddress
String

indirizzo a cui inviare il messaggio

scAddress
String

è l'indirizzo del centro servizi o null per usare l'SMSC predefinito corrente

text
String

corpo del messaggio da inviare

sentIntent
PendingIntent

se non NULL, questo <codice>PendingIntent</code> viene trasmesso quando il messaggio viene inviato correttamente o non è riuscito. Il codice del risultato sarà <codice>Activity.RESULT_OK</codice> per l'esito positivo oppure uno di questi errori:<<> codice>br RESULT_ERROR_GENERIC_FAILURE</codice><br>><RESULT_ERROR_RADIO_OFF</codice><br><>codice RESULT_ERROR_NULL_PDU<</codice><br<>>RESULT_ERROR_NO_SERVICE/codice><br RESULT_ERROR_LIMIT_EXCEEDED/codice br<>del codice>RESULT_ERROR_LIMIT_EXCEEDED</codice br><>><<RESULT_ERROR_FDN_CHECK_FAILURE/code><br><code>RESULT_ERROR_SHORT_CODE_NOT_ALLOWED</><code br><>code RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED</code><br><code>RESULT_RADIO_NOT_AVAILABLE</code><br><code>RESULT_NETWORK_REJECT</code><br><>code RESULT_INVALID_ARGUMENTS</code><br code RESULT_INVALID_STATE/code br<>code>RESULT_INVALID_STATE</code><br><codice>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 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_>><><Codice>< RESULT_RIL_RADIO_NOT_AVAILABLE</codice><br<>>< RESULT_RIL_SMS_SEND_FAIL_RETRY/codice><br<>codice>RESULT_RIL_NETWORK_REJECT</codice><br RESULT_RIL_INVALID_STATE/><codice RESULT_RIL_INVALID_ARGUMENTS< br><<>>>< RESULT_RIL_NO_MEMORY/codice br codice br RESULT_RIL_NO_MEMORY</><codice br><>><br><codice>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 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_> CODICE RESOURCES</code><br<>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/codice> o uno degli errori di RESULT_RIL, sentIntent può includere il valore aggiuntivo "errorCode" contenente un valore specifico della tecnologia radio, in genere utile solo per la risoluzione dei problemi.<br>

deliveryIntent
PendingIntent

se non NULL, questo <codice>PendingIntent</code> viene trasmesso quando il messaggio viene recapitato al destinatario. Il pdu non elaborato del report di stato si trova nei dati estesi ("pdu").

messageId
Int64

ID che identifica in modo univoco il messaggio richiesto per l'invio. Usato per scopi di registrazione e diagnostica. L'ID può essere 0.

Attributi

Commenti

Inviare un SMS basato su testo. Uguale a #sendTextMessage( String destinationAddress, String scAddress, String text, PendingIntent sentIntent, PendingIntent deliveryIntent), ma aggiunge un messageId facoltativo.

per android.telephony.SmsManager.sendTextMessage(java.lang.String, java.lang.String, java.lang.String, android.app.PendingIntent, android.app.PendingIntent, long).

Le parti di questa pagina sono modifiche basate sul lavoro creato e condiviso dalla e usati in base ai termini descritti in Creative License 2.5 Attribution License.

Si applica a

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

Inviare un SMS basato su testo.

[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

Parametri

destinationAddress
String

indirizzo a cui inviare il messaggio

scAddress
String

è l'indirizzo del centro servizi o null per usare l'SMSC predefinito corrente

text
String

corpo del messaggio da inviare

sentIntent
PendingIntent

se non NULL viene PendingIntent trasmesso quando il messaggio viene inviato correttamente o non è riuscito. Il codice del risultato sarà Activity.RESULT_OK per esito positivo o uno di questi errori:<br>RESULT_ERROR_GENERIC_FAILURE<>RESULT_ERROR_RADIO_OFF<>RESULT_ERROR_NULL_PDU<>RESULT_ERROR_NO_SERVICE<>RESULT_ERROR_LIMIT_EXCEEDED<>RESULT_ERROR_FDN_CHECK_FAILURE<>RESULT_ERROR_SHORT_CODE_NOT_ALLOWED<>RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED<>RESULT_RADIO_NOT_AVAILABLE<>RESULT_NETWORK_REJECT<>RESULT_INVALID_ARGUMENTS<>RESULT_INVALID_STATE<>RESULT_NO_MEMORY<>RESULT_INVALID_SMS_FORMAT<>RESULT_SYSTEM_ERROR<>RESULT_MODEM_ERROR<>RESULT_NETWORK_ERROR<>RESULT_ENCODING_ERROR<>RESULT_INVALID_SMSC_ADDRESS<>RESULT_OPERATION_NOT_ALLOWED<br>RESULT_INTERNAL_ERROR<><RESULT_NO_RESOURCESbr br>brRESULT_RIL_ENCODING_ERR<>RESULT_CANCELLED<>RESULT_REQUEST_NOT_SUPPORTED<>RESULT_NO_BLUETOOTH_SERVICE<>RESULT_INVALID_BLUETOOTH_ADDRESS<>RESULT_BLUETOOTH_DISCONNECTED<>RESULT_UNEXPECTED_EVENT_STOP_SENDING<>RESULT_SMS_BLOCKED_DURING_EMERGENCY<>RESULT_SMS_SEND_RETRY_FAILED<>RESULT_REMOTE_EXCEPTION<>RESULT_NO_DEFAULT_SMS_APP<>RESULT_RIL_RADIO_NOT_AVAILABLE<>RESULT_RIL_SMS_SEND_FAIL_RETRY<>RESULT_RIL_NETWORK_REJECT<>RESULT_RIL_INVALID_STATE<>RESULT_RIL_INVALID_ARGUMENTS<>RESULT_RIL_NO_MEMORY<>RESULT_RIL_REQUEST_RATE_LIMITED<>RESULT_RIL_INVALID_SMS_FORMAT<>RESULT_RIL_SYSTEM_ERR<>RESULT_RIL_INVALID_SMSC_ADDRESS<br>>><<RESULT_RIL_NETWORK_ERR>RESULT_RIL_INTERNAL_ERR<>RESULT_RIL_REQUEST_NOT_SUPPORTEDRESULT_RIL_MODEM_ERR<RESULT_RIL_OPERATION_NOT_ALLOWED><>RESULT_RIL_NETWORK_NOT_READY><RESULT_RIL_NO_RESOURCESRESULT_RIL_INVALID_MODEM_STATE><<RESULT_RIL_CANCELLEDRESULT_RIL_SIMULTANEOUS_SMS_AND_CALL_NOT_ALLOWED><<>RESULT_RIL_SIM_ABSENTRESULT_RIL_ACCESS_BARRED<><RESULT_RIL_BLOCKED_DUE_TO_CALL<>> For RESULT_ERROR_GENERIC_FAILURE o uno qualsiasi degli errori RESULT_RIL, sentIntent può includere l'extra "errorCode" contenente un valore specifico della tecnologia radio, generalmente utile solo per risoluzione dei problemi.<br>

deliveryIntent
PendingIntent

se non NULL viene PendingIntent trasmesso quando il messaggio viene recapitato al destinatario. Il pdu non elaborato del report di stato si trova nei dati estesi ("pdu").

Attributi

Eccezioni

se destinationAddress o text sono vuoti

Commenti

Inviare un SMS basato su testo.

<nota forte>:</strong> Uso di questo metodo richiede che l'app disponga dell'autorizzazione android.Manifest.permission#SEND_SMS .

<nota forte>:</>strong A partire da Android 4.4 (livello API 19), se em>e solo se<</em> un'app non è selezionata come app SMS predefinita, il sistema scrive automaticamente i messaggi inviati tramite questo metodo al provider SMS (l'app SMS predefinita è sempre responsabile della scrittura dei messaggi inviati al provider SMS). Per informazioni sul comportamento dell'app SMS predefinita, vedere android.provider.Telephony.

<nota>forte:</strong> Se #getDefault() viene usata per creare un'istanza di questo gestore in un dispositivo multi-SIM, questa operazione potrebbe non riuscire a inviare il messaggio SMS perché non è possibile trovare alcuna sottoscrizione predefinita appropriata. In questo caso, se sentIntent è diverso da null, verrà PendingIntent inviato con un codice RESULT_ERROR_GENERIC_FAILURE di errore e una stringa "noDefault" aggiuntiva contenente il valore truebooleano . Per #getDefault() altre informazioni sulle condizioni in cui l'operazione potrebbe non riuscire, vedere .

per android.telephony.SmsManager.sendTextMessage(java.lang.String, java.lang.String, java.lang.String, android.app.PendingIntent, android.app.PendingIntent).

Le parti di questa pagina sono modifiche basate sul lavoro creato e condiviso dalla e usati in base ai termini descritti in Creative License 2.5 Attribution License.

Si applica a