IOS - how to make the app screen always lit?

6

I'm making an app for IOS that I already have ready on Android, I wanted to make a method that would leave the screen always on, but I'm not able to

On Android I did it this way:

MainActivity:

PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK, "watever");
wl.acquire();

Manifest:

<uses-permission android:name="android.permission.WAKE_LOCK" />

If someone knows what it would be like for IOS, I'm grateful for the help, Hugs!

    
asked by anonymous 01.02.2016 / 12:58

1 answer

4

According to the documentation you can use the idleTimerDisabled method:

Swift

UIApplication.sharedApplication().idleTimerDisabled = true

Objective-C

[[UIApplication sharedApplication] setIdleTimerDisabled: YES];

Remembering that you need to import UIKit

    
01.02.2016 / 13:45