Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Cross-Platform-Entwicklung (https://www.delphipraxis.net/91-cross-platform-entwicklung/)
-   -   Firemonkey IOS Bug (https://www.delphipraxis.net/178977-firemonkey-ios-bug.html)

Peter666 6. Feb 2014 13:18

Firemonkey IOS Bug
 
Hi,

für eine Anwendung habe ich einen UIBackgroundModes Eintrag für audio in meiner plist. Spiele ich nun einen Song ab und gehe in den Lockscreen crasht die Anwendung. Ich habe einen Timer laufen der u.a. ein paar Labels aktualisiert und es crasht sobald das geschieht. Gibt es eine Möglichkeit zu erkennen ob die jeweilige App im Hintergrund ist bzw. gerade in den Hintergrundmodus wechselt? Das ganze tritt nur auf, wenn man von der eigenen App in den Lockscreen geht und nicht wenn man den Homebutton gedrückt hat und Homemenü in den Lockscreen geht.

danielmagin 7. Feb 2014 20:28

AW: Firemonkey IOS Bug
 
Ich gehe davon aus du benutzt Delphi XE5

ganze einfach:
Im Main Form Create:
Delphi-Quellcode:
procedure TfrmMain.FormCreate(Sender: TObject);
var
  AppEventSvc: IFMXApplicationEventService;
begin
  //do not forget to add in uses FMX.Platform

  if TPlatformServices.Current.SupportsPlatformService(IFMXApplicationEventService, IInterface(AppEventSvc)) then
    AppEventSvc.SetApplicationEventHandler(AppEvent);
end;
dann im form private Bereich

Delphi-Quellcode:
  TfrmMain = class(TForm)
  .....
    private
    { Private declarations }

      .....

    function AppEvent(AAppEvent: TApplicationEvent; AContext: TObject): Boolean;
Implementierung:

Delphi-Quellcode:
function TfrmMain.AppEvent(AAppEvent: TApplicationEvent; AContext: TObject): Boolean;
begin
  case AAppEvent of
    aeFinishedLaunching:
      begin
      end;

    aeBecameActive:
      begin
///code z.b. hier
      end;

    aeWillBecomeInactive:
      ;
    aeEnteredBackground:
      begin
        // StopThreads;

       ///code z.b. hier
      end;
    aeWillBecomeForeground:
      begin

      end;
    aeWillTerminate:
      ;
    aeLowMemory:
      ;
    aeTimeChange:
      ;
    aeOpenURL:
      ;
  end;
end;

gruss Daniel Magin :-D
DeveloperExpert.net


Alle Zeitangaben in WEZ +1. Es ist jetzt 11:10 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz