Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Xamarin.Forms (Android) でスリープ状態にさせないためには
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
global::Xamarin.Forms.Forms.Init(this, bundle);
LoadApplication(new App());
// スクリーンオフやロックスクリーン回避
Window.AddFlags(Android.Views.WindowManagerFlags.KeepScreenOn |
Android.Views.WindowManagerFlags.DismissKeyguard |
Android.Views.WindowManagerFlags.ShowWhenLocked |
Android.Views.WindowManagerFlags.TurnScreenOn);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment