SmsManager.SendDataMessage Metodo

Definizione

Inviare un SMS basato su dati a una porta applicazione specifica.

[Android.Runtime.Register("sendDataMessage", "(Ljava/lang/String;Ljava/lang/String;S[BLandroid/app/PendingIntent;Landroid/app/PendingIntent;)V", "")]
public void SendDataMessage(string? destinationAddress, string? scAddress, short destinationPort, byte[]? data, Android.App.PendingIntent? sentIntent, Android.App.PendingIntent? deliveryIntent);
[<Android.Runtime.Register("sendDataMessage", "(Ljava/lang/String;Ljava/lang/String;S[BLandroid/app/PendingIntent;Landroid/app/PendingIntent;)V", "")>]
member this.SendDataMessage : string * string * int16 * byte[] * 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

destinationPort
Int16

porta a cui recapitare il messaggio

data
Byte[]

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 i dati sono vuoti

Commenti

Inviare un SMS basato su dati a una porta applicazione specifica.

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

<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.sendDataMessage(java.lang.String, java.lang.String, short, byte[], 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