Delphi FMX And​​roid应用程序。如何打开短信窗口 [英] Delphi FMX Android app. How to open SMS window

查看:98
本文介绍了Delphi FMX And​​roid应用程序。如何打开短信窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Android phode上打开带有预先键入的消息文本和收件人编号的短信服务(SMS)窗口。

How I can open Short Message Service (SMS) window on Android phode with pretyped message text and recipient number.

在手册中,我仅找到电话拨号程序

In manuals i found only Phone dialer

      PhoneDialerService.Call(edtTelephoneNumber.Text)

允许拨打电话,但与发送SMS消息无关。

which allow make call, but nothing about sending SMS messages.

推荐答案

请参阅类 SMSManager

有一个 sendTextMessage 您可以使用的方法:

There is a sendTextMessage method that you can use:

尝试如下代码:

uses
  Androidapi.Helpers,
  Androidapi.JNI.JavaTypes, 
  Androidapi.JNI.Telephony;

procedure TForm1.Button1Click(Sender: TObject);
var
  destAdress: JString;
  smsManager: JSmsManager;
begin
  smsManager := TJSmsManager.JavaClass.getDefault;
  destAdress := StringToJString('0034123456789');
  smsManager.sendTextMessage(destAdress, nil, StringToJString('The message content'), nil, nil);
end;

您必须为项目配置添加权限。请参阅发送SMS:

You must add permissions to the project configuration. See the "Send SMS":


发送SMS-允许应用程序发送SMS消息。

Send SMS - Allows an application to send SMS messages.

致谢。

这篇关于Delphi FMX And​​roid应用程序。如何打开短信窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆