2016-07-13 2 views
2

iOS의 Android에 코드 포인트에서 확인할 수있는 것이 있습니까?iOS 및 Android의 앱 재개 상태

예컨대 앱이 최소화되고 복원되면 앱이 기기의 백그라운드에서 계속 실행됩니다.

감사합니다, 당신은 사용자가 배경을 입력하고 있는지 알고 AppDelegate에의

applicationDidEnterBackground 

에 플래그를 추가 할 수 있습니다 아이폰 OS에서

답변

1

IFMXApplicationEventService을 사용해야합니다. 이벤트 유형 here에 대한

uses FMX.Types, FMX.Platform; 

function TForm1.HandleAppEvent(AAppEvent: TApplicationEvent; AContext: TObject): Boolean; 
begin 
    case AAppEvent of 
    TApplicationEvent.FinishedLaunching: Log.d('Launched.'); 
    TApplicationEvent.BecameActive:   Log.d('Gained focus.'); 
    TApplicationEvent.EnteredBackground: Log.d('Now running in background.'); 
    TApplicationEvent.WillBecomeForeground: Log.d('Restoring from background.'); 
    TApplicationEvent.WillBecomeInactive: Log.d('Going to lose focus.'); 
    TApplicationEvent.WillTerminate:  Log.d('Quitting the application.'); 
    TApplicationEvent.LowMemory:   Log.d('Device running out of memory.'); 

    // iOS only 
    TApplicationEvent.TimeChange:   Log.d('Significant change in time.'); 
    TApplicationEvent.OpenURL:    Log.d('Request to open an URL.'); 
    end; 

    Result := True; 
end; 

procedure TForm11.FormCreate(Sender: TObject); 
var 
    aFMXApplicationEventService: IFMXApplicationEventService; 
begin 
    if TPlatformServices.Current.SupportsPlatformService(IFMXApplicationEventService, 
    IInterface(aFMXApplicationEventService)) 
    then 
    aFMXApplicationEventService.SetApplicationEventHandler(HandleAppEvent) 
    else 
    Log.d('Application Event Service not supported.'); 
end; 

더 많은 정보 : 응용 프로그램이 통보됩니다 콜백 어.

good article에 의해 Paweł Głowacki (Delphi XE5의 경우에도 유용함).

0

,

applicationDidBecomeActive 

알고 그 사용자의 반환에 배경의 앱