IOS - How to make the app screen always lit?

Asked

Viewed 145 times

6

I’m making an app for IOS I already have ready on Android, I wanted to make a method that left the screen always lit, but I’m not getting

On Android I did 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" />

In case anyone knows what it would be like for IOS, I’m grateful for the help, Hug!

1 answer

4


According to the apple documentation you can use the method idleTimerDisabled:

Swift

UIApplication.sharedApplication().idleTimerDisabled = true

Objective-C

[[UIApplication sharedApplication] setIdleTimerDisabled: YES];

Remembering that you need to import the UIKit

Browser other questions tagged

You are not signed in. Login or sign up in order to post.