Turn on/off iOS device's screen via script?

Hi, is there a way to turn on/off an iOS devices’ screen via c# script?

What I want to do is to turn the screen off when it is not in use(for example the device is placed on a surface), but keep the application running, and turn the screen on if the device is in use later.

For iOS device if the screen is turned off, it means the device is in ‘stand-by’ state so you have to manually turn it on by pressing the home button or the power button, and unlock the phone. I don’t want the device to be locked when the screen is off, but I don’t know how and I don’t think Apple offers that functionality. I’m just curious if anyone came up with a solution or something(like jail-breaking).

Kind of a hacky solution, but the first thing that comes to mind is:

  1. Create a black texture that fills the screen and set it’s alpha to 0 (100% transparent).
  2. Use the front camera and GetPixels to check if most of the pixels are black (i.e. the camera is facing down against a table or something).
  3. Enable the black screen if step 2 is true.
  4. Periodically (using coroutine) check if pixels are not mostly black, and “wake the app up” by then slowly fading out the black screen alpha.

Of course, you’ll want to create a bool called something like “isSleeping” and call it if the phone is “sleeping.” Then, set all of your rendering to very low quality to save as much battery as possible. At the minimum, I would put a null check in every Update function.