android - DELPHI XE5 如何在 ANDROID 中发送带送达通知的短信

标签 android delphi

我知道如何从 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 中可以吗?

感谢您的回答。 乔治

最佳答案

来自Android's documentation :

Parameters

  • destinationAddress the address to send the message to
  • scAddress is the service center address or null to use the current default SMSC
  • text the body of the message to send
  • sentIntent 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/

相关文章:

Android点击按钮填充textview

java - Android - 将 MediaMuxer 与 MediaExtractor 和 PCM 流一起使用会导致视频帧损坏

Delphi,将 cookie 集成或组合或加入到互联网浏览器

delphi - 我的 Delphi 应用程序完成初始化后,我应该在哪里放置要执行的代码?

delphi - 我可能在 Delphi XE2 中破坏了什么?

delphi - Delphi设置为仅读取文件夹和子文件夹中的文件

android - 来自 XML 字符串的 HashMap - Android

android - Android Facebook 登录中不调用回调函数

java - 无法为 org.gradle.api.internal.artifacts.dsl.dependency.DefaultDependencyHandler 类型的对象设置未知属性 'nav_version'

android-studio - Delphi Firemonkey 选项卡控件 Android