how can send sms form delphi app in android?
please see this examples
Example 1:
// First, let's open our permission Project / Options / Permissions "app to send SMS"
must be selected.
// Remember to go into the Project / Options / Permissions and allow the app to send SMS. The code is:
uses
fmx.helpers.android,
androidapi.jnı.graphicscontentviewtext,
androidapi.jnı.net,
androidapi.jnı.javatypes,
androidapi.jnı.telephony;
SendSMS procedure (target is messagest: string);
there is
smsmanag: You are jsmsmanag;
smsto: jstring;
begin
smsmanag is: = tjsmsmanager.javaclass.getdefault;
smsto = stringtojstring (target);
smsmanager.sendtextmessag to (smsto, nil, stringtojstring (The messagest), nil, nil);
end;
*************************************************
Example 2:
Try to pass empty value (nil) to the scaddress parameter of the function call to use sendtextmessag to the current default SMS center:
uses
androidapi.jnı.javatypes, androidapi.jnı.telephony;
procedure TForm1.Button1Click (Sender: TObject);
there is
smsto: jstring;
smsmanag: You are jsmsmanag;
begin
smsmanag is: = tjsmsmanager.javaclass.getdefault;
smsto = stringtojstring ('091 ...');
smsmanager.sendtextmessag to (smsto, nil, stringtojstring ('test SMS'), nil, nil);
end;
Important Note: Most of my code into notepad deposited collected from different sources. For this reason, most of them do not specify a source. That in cases like this and there is a spell that you know the source code will be requested to notify the comments. Regards.
No comments:
Post a Comment