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)
which allow make call, but nothing about sending SMS messages.
See the class SMSManager
on Android API.
There is a sendTextMessage
method that you can use:
Try some code like this:
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;
You must add permissions to the project configuration. See the "Send SMS":
Send SMS - Allows an application to send SMS messages.
Regards.