我知道如何从 Android 发送短信。非常简单:
var
smsTo: JString;
smsManager: JSmsManager;
begin
smsManager := TJSmsManager.JavaClass.getDefault;
smsTo := StringToJString('number_xxx');
smsManager.sendTextMessage(smsTo, nil, StringToJString('Test SMS'), nil, nil);
但问题是:如何发送带有收件人的短信?在 Delphi XE5 中可以吗?
感谢您的回答。 乔治
最佳答案
Parameters
destinationAddress
the address to send the message toscAddress
is the service center address or null to use the current default SMSCtext
the body of the message to sendsentIntent
if not NULL this PendingIntent is broadcast when the message is successfully sent, or failed. The result code will be Activity.RESULT_OK for success, or one of these errors: RESULT_ERROR_GENERIC_FAILURE RESULT_ERROR_RADIO_OFF RESULT_ERROR_NULL_PDU. The per-application based SMS control checks sentIntent. If sentIntent is NULL the caller will be checked against all unknown applications, which cause smaller number of SMS to be sent in checking period.deliveryIntent
if not NULL this PendingIntent is broadcast when the message is delivered to the recipient. The raw pdu of the status report is in the extended data ("pdu").
您的代码中显然缺少最后两个参数。
Here's如何在 Java 中做到这一点——非常简单,但 Delphi 对我们来说有点困难。看看答案here .最有意思的是the first link在答案中。
基本上您需要使用 JNI 包装器直接与 Java 类通信,因为 Delphi 没有公开此处所需的功能 - 至少我什么都不知道。
祝你好运!
关于android - DELPHI XE5 如何在 ANDROID 中发送带送达通知的短信,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19463601/