Back

GoToSleep

The GoToSleep method forces the screen to turn off and puts the device to sleep. This has the same effect as pressing the power button.

 app.GoToSleep();

After using this function rotating the phone/tablet will have no effect on the app's orientation. To unlock the orientation call the function again using the orientation "Default".

Example

function OnStart()
{
  app.GoToSleep();
}
  Copy   Copy All    Run