How to avoid the screen to lock while the Windows

2019-04-05 02:25发布

问题:

Easy as that, in android there's a setting called Stay awake that will prevent your phone to lock down while you're using it for debugging an app.

I'm looking for the same thing (could be better) for Windows Phone 8.1.

Every time I hit F5 I need to unlock my phone or I would get the following error:

DEP6600 : Deployment failed. Cannot deploy app when device screen is locked. Please make sure that the device screen is not locked, and try again.

or

Error: Application launch failed. Ensure that the device screen is unlocked and device is developer unlocked. For details on developer unlock, visit http://go.microsoft.com/fwlink/?LinkId=195284

if I run the AppDeployCmd tool myself.

Is there a way I can avoid that? (without changing my lock screen time out every time of course)

回答1:

I don't think you can do this without writing a separate app. On the phone there is an option: Settings > Lock Screen > Screen time out, which you can set to maximum available. For same phones, like lower end Nokias there is an option to set that time to never, however for newer phones such as Nokia 1320 or Nokia 1520 that maximum is only 5 minutes.



回答2:

I think it isn't possible, but here is an alternative

EDIT: You can write an separate app, wich you should run while you're developing other apps. This app must consist of this lines code.

DisplayRequest AppDisplayRequest = new DisplayRequest();

public MainPage()
{
     AppDisplayRequest.RequestActive();
}
void HardwareButtons_BackPressed(object sender, Windows.Phone.UI.Input.BackPressedEventArgs e)
{
     AppDisplayRequest.RequestRelease();
     e.Handled = true;
     Windows.Phone.UI.Input.HardwareButtons.BackPressed -= HardwareButtons_BackPressed;
     Application.Current.Exit();
}


回答3:

The resolution for the error DEP6600 should be there in the code itself instead of writing a separate app. how can this be done. in other words, the moment my app is compiled build and after deployment the error shouldn't come and the app should run even when the phone is locked