Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XE4 Firemonkey on iOS prevent sleep mode

I am developing an app in Firemonkey XE4 for iOS and need to prevent the device from sleeping when there is no user input. I have found this command for xcode development:

[application setIdleTimerDisabled:YES];

I presume there is an equivalent in FMX?

Can anyone help please?

Thanks

Darryl

like image 925
user2378412 Avatar asked Oct 18 '25 19:10

user2378412


1 Answers

You can go straight to UIApplication, as so:

uses
  iOSapi.UIKit;

{$R *.fmx}

procedure TForm6.Button1Click(Sender: TObject);
var
  UIApp : UIApplication;
begin
  UIApp := TUIApplication.Wrap(TUIApplication.OCClass.sharedApplication);
  UIApp.setIdleTimerDisabled(True);
end;
like image 182
Malcolm Groves Avatar answered Oct 20 '25 08:10

Malcolm Groves



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!