[英]Delphi Firemonkey ios Background Fetch
我正在尝试使用delphi Firemonkey开发iphone应用程序。 如果有新的数据发送通知,我需要每隔X分钟下载一个xml并进行处理。 如果应用程序正在使用中,这非常容易,但是当应用程序在后台时,我找不到使用此过程的方法。
请帮我...
Tnx很多...但是我不能这样做....这是我最简单的代码,不起作用...我的错误是什么???
procedure TForm1.Button1Click(Sender: TObject);
var
IdHTTP1 : TIdHTTP;
MyFile : TFileStream;
Notification: TNotification;
UIApp : UIApplication;
begin
UIApp := TUIApplication.Wrap(TUIApplication.OCClass.sharedApplication);
UIApp.setIdleTimerDisabled(True);
TThread.CreateAnonymousThread(procedure ()
var
I: Integer;
Total: Integer;
begin
Total := 0;
while true do
begin
// Carico l'XML
MyFile:= TFileStream.Create(TPath.GetDocumentsPath + TPath.DirectorySeparatorChar+'listticket',fmCreate);
IdHTTP1 := TIdHTTP.Create(nil);
IdHTTP1.Get('http://www.google.com', MyFile);
IdHTTP1.Free;
MyFile.Free;
end;
sleep(5*60*1000);
TThread.Synchronize (TThread.CurrentThread,
procedure ()
begin
end);
end).Start;
end;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.