简体   繁体   中英

Delphi Firemonkey ios Background Fetch

i'm trying to use delphi Firemonkey to develop an iphone App. I need to download an xml every x minutes and process it, if there are new data send notification. It's very easy if the app is in use, but i can't find the way to use this procedure when the app is in background....

Please help me...

Tnx a lot...But i can't do this.... this is my simpliest code that doesn't work... What is my error???

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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM