标签:
FMX.Platform.TApplicationEvent
http://docwiki.embarcadero.com/Libraries/XE8/en/FMX.Platform.TApplicationEvent
TApplicationEvent = (FinishedLaunching, BecameActive, WillBecomeInactive, EnteredBackground, WillBecomeForeground, WillTerminate, LowMemory, TimeChange, OpenURL);
An instance of TApplicationEvent may have any of the following values:
Item | Description | Platform |
Android | iOS |
BecameActive
|
Your application has gained the focus.
|
Supported
|
Supported
|
EnteredBackground
|
The user is no longer using your application, but your application is still running in the background.
|
Supported
|
Supported
|
FinishedLaunching
|
Your application has been launched.
|
Supported
|
Supported
|
LowMemory
|
This warns your application that the device is running out of memory.
Your application should reduce memory usage, freeing structures and data that can be loaded again at a later point.
|
Supported
|
Supported
|
OpenURL
|
You application has received a request to open an URL.
Application events of this type are usually associated with a context. This context is an instance of the iOS-only TiOSOpenApplicationContext class, which provides the following read-only properties:
TiOSOpenApplicationContext.SourceApp is a string that contains the bundle ID of the application that requested your application to open the URL.
TiOSOpenApplicationContext.URL is the URL to open, either a network resource or a file.
TiOSOpenApplicationContext.Context is a pointer to a property-list object that might provide additional information.
See the iOS API reference documentation for more information.
|
|
Supported
|
TimeChange
|
There has been a significant change in time.
This event might happen for example when the day changes or when the device changes to or from daylight savings time.
|
|
Supported
|
WillBecomeForeground
|
The user is now using your application, which was previously in the background.
|
Supported
|
Supported
|
WillBecomeInactive
|
Your application is going to loose the focus.
|
Supported
|
Supported
|
WillTerminate
|
The user is quitting your application.
|
Supported
|
Supported
|
http://codeverge.com/embarcadero.delphi.ios/ifmxapplicationeventservice-not-firing/2028062
http://codeverge.com/embarcadero.delphi.firemonkey/keep-application-on-top/2009583
procedure TMainForm.FormCreate(Sender: TObject); var SvcEvents: IFMXApplicationEventService; begin if TPlatformServices.Current.SupportsPlatformService(IFMXApplicationEventService, IInterface(SvcEvents)) then SvcEvents.SetApplicationEventHandler(HandleAppEvent); Application.OnException := ExceptionHandler; end; function TMainForm.HandleAppEvent(AAppEvent: TApplicationEvent; AContext: TObject): Boolean; begin case AAppEvent of TApplicationEvent.FinishedLaunching: ; TApplicationEvent.BecameActive: ; TApplicationEvent.WillBecomeInactive: ; TApplicationEvent.EnteredBackground: ; TApplicationEvent.WillBecomeForeground: ; TApplicationEvent.WillTerminate: ; TApplicationEvent.LowMemory: ; TApplicationEvent.TimeChange: ; TApplicationEvent.OpenURL: ; end; Result := True; end; - See more at: http://codeverge.com/embarcadero.delphi.firemonkey/keep-application-on-top/2009583#sthash.6XM5jEUI.dpuf
procedure TMainForm.FormCreate(Sender: TObject); var SvcEvents: IFMXApplicationEventService; begin if TPlatformServices.Current.SupportsPlatformService(IFMXApplicationEventService, IInterface(SvcEvents)) then SvcEvents.SetApplicationEventHandler(HandleAppEvent); Application.OnException := ExceptionHandler; end; function TMainForm.HandleAppEvent(AAppEvent: TApplicationEvent; AContext: TObject): Boolean; begin case AAppEvent of TApplicationEvent.FinishedLaunching: ; TApplicationEvent.BecameActive: ; TApplicationEvent.WillBecomeInactive: ; TApplicationEvent.EnteredBackground: ; TApplicationEvent.WillBecomeForeground: ; TApplicationEvent.WillTerminate: ; TApplicationEvent.LowMemory: ; TApplicationEvent.TimeChange: ; TApplicationEvent.OpenURL: ; end; Result := True; end; - See more at: http://codeverge.com/embarcadero.delphi.firemonkey/keep-application-on-top/2009583#sthash.6XM5jEUI.dpuf
procedure TMainForm.FormCreate(Sender: TObject); var SvcEvents: IFMXApplicationEventService; begin if TPlatformServices.Current.SupportsPlatformService(IFMXApplicationEventService, IInterface(SvcEvents)) then SvcEvents.SetApplicationEventHandler(HandleAppEvent); Application.OnException := ExceptionHandler; end; function TMainForm.HandleAppEvent(AAppEvent: TApplicationEvent; AContext: TObject): Boolean; begin case AAppEvent of TApplicationEvent.FinishedLaunching: ; TApplicationEvent.BecameActive: ; TApplicationEvent.WillBecomeInactive: ; TApplicationEvent.EnteredBackground: ; TApplicationEvent.WillBecomeForeground: ; TApplicationEvent.WillTerminate: ; TApplicationEvent.LowMemory: ; TApplicationEvent.TimeChange: ; TApplicationEvent.OpenURL: ; end; Result := True; end; - See more at: http://codeverge.com/embarcadero.delphi.firemonkey/keep-application-on-top/2009583#sthash.6XM5jEUI.dpuf
http://codeverge.com/embarcadero.delphi.firemonkey/keep-application-on-top/2009583
procedure TMainForm.FormCreate( Sender : TObject );
var
SvcEvents : IFMXApplicationEventService;
begin
if TPlatformServices.Current.SupportsPlatformService
( IFMXApplicationEventService, IInterface( SvcEvents ) )
then
SvcEvents.SetApplicationEventHandler( HandleAppEvent );
Application.OnException := ExceptionHandler;
end;
function TMainForm.HandleAppEvent( AAppEvent : TApplicationEvent; AContext : TObject ) : Boolean;
begin
case AAppEvent of
TApplicationEvent.FinishedLaunching :
;
TApplicationEvent.BecameActive :
;
TApplicationEvent.WillBecomeInactive :
;
TApplicationEvent.EnteredBackground :
;
TApplicationEvent.WillBecomeForeground :
;
TApplicationEvent.WillTerminate :
;
TApplicationEvent.LowMemory :
;
TApplicationEvent.TimeChange :
;
TApplicationEvent.OpenURL :
;
end;
Result := True;
end;
//See more at : http://codeverge.com/embarcadero.delphi.firemonkey/keep-application-on-top/2009583
procedure TMainForm.FormCreate(Sender: TObject); var SvcEvents: IFMXApplicationEventService; begin if TPlatformServices.Current.SupportsPlatformService(IFMXApplicationEventService, IInterface(SvcEvents)) then SvcEvents.SetApplicationEventHandler(HandleAppEvent); Application.OnException := ExceptionHandler; end; function TMainForm.HandleAppEvent(AAppEvent: TApplicationEvent; AContext: TObject): Boolean; begin case AAppEvent of TApplicationEvent.FinishedLaunching: ; TApplicationEvent.BecameActive: ; TApplicationEvent.WillBecomeInactive: ; TApplicationEvent.EnteredBackground: ; TApplicationEvent.WillBecomeForeground: ; TApplicationEvent.WillTerminate: ; TApplicationEvent.LowMemory: ; TApplicationEvent.TimeChange: ; TApplicationEvent.OpenURL: ; end; Result := True; end; - See more at: http://codeverge.com/embarcadero.delphi.firemonkey/keep-application-on-top/2009583#sthash.6XM5jEUI.dpuf
FMX.Platform.TApplicationEvent
标签:
原文地址:http://www.cnblogs.com/cb168/p/5111695.html