Hi guys. It seems that is not possible to set an arbitrary value to the Screen.sleepTimeout variable because it will accept only SleepTimeout.NeverSleep or SleepTimeout.SystemSettings.
For security reason I need to lock the screen of my app when a certain amount of time is passed. After the the screen has been activated again, I need to ask for a password to enable the use of the app. I think that the best solution is to send the device to sleep so I can use the OnEnable and OnDisable functions to understand what it is the current state of my app.
I cannot rely on SleepTimeout.SystemSettings because if is set to never go to sleep or to a ridiculous amount of time it will not work.
My idea is to use a timer looking into the main Update loop for any inputs. If something occurs the timer will be resetted. In the same Update I can check for the timer to be gone so I can lock the app. Not much of a challenge.
The thing is that I really would like to send the device to sleep but I really don’t know if it is possible.
Do you know how to do it or, eventually, do you know any other solution?
Thank you very much