标签:until job nec could procedure acl assigned exce proc
主要解决的问题是:在屏幕处于锁屏或关闭状态下,无法正常显示MessageDlg
procedure WaitUntilScreenIsActive; begin while True do begin Application.ProcessMessages; if isScreenOn and isKeyguardunLock then Break; end; end; function isScreenOn : Boolean; var Native:JObject ; PowerManager : JPowerManager; begin Native:=SharedActivityContext.getSystemService(TJContext.JavaClass.POWER_SERVICE); if not Assigned(Native) then begin raise Exception.Create(‘Could not locate Connectivity Service‘); end; PowerManager := TJPowerManager.Wrap((Native as ILocalObject).GetObjectID) ; if not Assigned(PowerManager) then Result := True else Result := PowerManager.isScreenOn; Native:=SharedActivityContext.getSystemService(TJContext.JavaClass.KEYGUARD_SERVICE); end; function isKeyguardunLock : Boolean; var Native:JObject ; KeyguardManager : JKeyguardManager; begin Native:=SharedActivityContext.getSystemService(TJContext.JavaClass.KEYGUARD_SERVICE); if not Assigned(Native) then begin raise Exception.Create(‘Could not locate Connectivity Service‘); end; KeyguardManager := TJKeyguardManager.Wrap((Native as ILocalObject).GetObjectID) ; if not Assigned(KeyguardManager) then Result := True else Result := not KeyguardManager.isKeyguardLocked; end;
标签:until job nec could procedure acl assigned exce proc
原文地址:http://www.cnblogs.com/dannylee/p/7656656.html