Langue

SmsManager.SendDataMessage Méthode

Définition

Envoyez un SMS basé sur des données à un port d’application spécifique.

[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

Paramètres

destinationAddress
String

adresse à laquelle envoyer le message

scAddress
String

est l’adresse du centre de services ou null pour utiliser le SMSC par défaut actuel

destinationPort
Int16

port vers lequel remettre le message

data
Byte[]

corps du message à envoyer

sentIntent
PendingIntent

s’il n’est pas NULL, cette PendingIntent opération est diffusée lorsque le message est correctement envoyé ou a échoué. Le code de résultat sera Activity.RESULT_OK pour succès, ou l’une de ces erreurs :br>><<>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_ERROR_NULL_PDURESULT_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_ACCESS_BARRED<>><RESULT_RIL_SIM_ABSENTRESULT_RIL_SIMULTANEOUS_SMS_AND_CALL_NOT_ALLOWED<>RESULT_RIL_OPERATION_NOT_ALLOWED><<RESULT_RIL_NO_RESOURCES><<RESULT_RIL_BLOCKED_DUE_TO_CALL<>RESULT_RIL_CANCELLED>RESULT_RIL_INTERNAL_ERR<RESULT_RIL_NETWORK_ERR<RESULT_RIL_NETWORK_NOT_READY><RESULT_RIL_INVALID_MODEM_STATERESULT_RIL_REQUEST_NOT_SUPPORTED>>br><RESULT_RIL_MODEM_ERRRESULT_RIL br>RESULT_ERROR_GENERIC_FAILURE résolution des problèmes.<br>

deliveryIntent
PendingIntent

s’il n’est pas NULL, il s’agit PendingIntent d’une diffusion lorsque le message est remis au destinataire. Le pdu brut du rapport d’état se trouve dans les données étendues (« pdu »).

Attributs

Exceptions

si destinationAddress ou les données sont vides

Remarques

Envoyez un SMS basé sur des données à un port d’application spécifique.

< >strong Remarque :</strong> Utilisation de cette méthode nécessite que votre application dispose de l’autorisationandroid.Manifest.permission#SEND_SMS.

< >strong Remarque :</strong> Si #getDefault() est utilisé pour instancier ce gestionnaire sur un appareil multi-SIM, cette opération peut échouer à envoyer le sms, car aucun abonnement par défaut approprié n’est trouvé. Dans ce cas, s’il sentIntent s’agit d’une valeur non null, le PendingIntent fichier est envoyé avec un code RESULT_ERROR_GENERIC_FAILURE d’erreur et une chaîne "noDefault" supplémentaire contenant la valeur truebooléenne. Pour #getDefault() plus d’informations sur les conditions dans lesquelles cette opération peut échouer.

Java documentation pour android.telephony.SmsManager.sendDataMessage(java.lang.String, java.lang.String, short, byte[], android.app.PendingIntent, android.app.PendingIntent).

Les parties de cette page sont des modifications basées sur le travail créé et partagé par Android Open Source et utilisées en fonction des termes décrits dans la Creative Commons 2.5 Attribution License.

S’applique à