unit Dxc;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls,
FMX.Layouts, FMX.Memo,FMX.Platform.Android, FMX.Edit,System.Math, FMX.ListBox;
type
TSendSMSForm = class(TForm)
StatusBar1: TStatusBar;
ToolBar1: TToolBar;
Memo1: TMemo;
Button1: TButton;
StyleBook1: TStyleBook;
Button2: TButton;
Button3: TButton;
Memo2: TMemo;
Label1: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Button4: TButton;
Panel1: TPanel;
Panel2: TPanel;
Panel3: TPanel;
Panel4: TPanel;
Panel5: TPanel;
Panel6: TPanel;
Panel7: TPanel;
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
SendSMSForm: TSendSMSForm;
myThread: TThread;
implementation
{$R *.fmx}
uses
Androidapi.JNI.JavaTypes,Androidapi.JNI.Telephony,System.IoUtils,androidapi.IOUtils;
function SendSMS(tel,str:string):Boolean;
var
j: JSmsManager;
begin
j := tjsmsmanager.Create;
j.sendTextMessage(stringtojstring(tel), nil, stringtojstring(str), nil, nil);
Result := True;
end;
procedure MyMethod;
var
i,x: Integer;
str:string;
tel:string;
s:string;
begin
for i := 0 to SendSMSForm.Memo2.Lines.Count -1 do
begin
// str:=SendSMSForm.Memo1.Lines.Text+datetimetostr(Now);
str:=SendSMSForm.Memo1.Lines.Text;
tel:=SendSMSForm.Memo2.Lines.Strings[i];
if (Trim(tel)<>'') and (Trim(str)<>'') then begin
SendSMS(tel,str);
end;
x:= RandomRange(StrToInt(SendSMSForm.Edit1.Text)*1000,StrToInt(SendSMSForm.Edit2.Text)*1000);
Sleep(x);
end;
end;
procedure TSendSMSForm.Button1Click(Sender: TObject);
begin
myThread := TThread.CreateAnonymousThread(MyMethod); //!!!
myThread.Start;
end;
procedure TSendSMSForm.Button2Click(Sender: TObject);
begin
MainActivity.finish;
end;
procedure TSendSMSForm.Button3Click(Sender: TObject);
begin
myThread.suspend;
end;
procedure TSendSMSForm.Button4Click(Sender: TObject);
var
i:Integer;
s,m:string;
begin
for s in TDirectory.GetFiles(Androidapi.IOUtils.GetSharedCameraDir) do
Memo1.Lines.Add(s);
for s in TDirectory.GetDirectories('/storage')do
Memo1.Lines.Add(s);
for s in TDirectory.GetDirectoryRoot('/storage/sdcard0/DCIM/Camera')do
Memo1.Lines.Add(s);
Memo1.Lines.Add('/');
for s in TDirectory.GetDirectories(TDirectory.GetDirectoryRoot('/storage/sdcard0/DCIM/Camera'))do
Memo1.Lines.Add(s);
end;
end.
XE5发短信以及目录
最新推荐文章于 2020-09-24 16:52:26 发布