How do I prevent an Android device from going to sleep programmatically?

Viewed 182701

How do I prevent an Android device from going to sleep programmatically?

8 Answers

If you are a Xamarin user, this is the solution:

   protected override void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle); //always call superclass first

        this.Window.AddFlags(WindowManagerFlags.KeepScreenOn);

        LoadApplication(new App());
    }
Related