I wanted to know how exactly i can add WindowManager's LayoutParams flag inside C# code of xamarin.
For example we can do it in Android by code given below.
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON|
WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD|
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED|
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
Like so:
namespace SampleCode
{
[Activity (Label = "SampleCode", MainLauncher = true, Icon = "@drawable/icon")]
public class MainActivity : Activity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
// Set our view from the "main" layout resource
SetContentView (Resource.Layout.Main);
Window.AddFlags(WindowManagerFlags.KeepScreenOn|
WindowManagerFlags.DismissKeyguard|
WindowManagerFlags.ShowWhenLocked|
WindowManagerFlags.TurnScreenOn);
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With