Home > DeveloperSection > Forums > How to disable Auto Locking when our windows phone app is running?
Samuel Fernandes
Samuel Fernandes

Total Post:156

Points:1096
Posted on    April-07-2015 7:56 AM

 .NET Windows Phone 
Ratings:


 1 Reply(s)
 459  View(s)
Rate this:

i am developing a windows phone app in which i fetching some data from service at that moment the device will go to auto lock since it is un - responsive for long time.

so , how can i avoid this auto locking in the windows phone app when some process/fetching/syncing is happening with services.

i am not able test this scenario since i am testing it on an emulator.

1) how to avoid auto locking feature in windows phone app when it is running? 2) What are the various possible ways in which i can do this ?



Mayank Tripathi
Mayank Tripathi

Total Post:397

Points:3117
Supported
Posted on    April-07-2015 8:05 AM

You can do the following:

using Microsoft.Phone.Shell;

PhoneApplicationService phoneAppService = PhoneApplicationService.Current;
phoneAppService.ApplicationIdleDetectionMode = IdleDetectionMode.Disabled;

This will disable auto locking of screen. Let me know if this works.

Edit: This code should be added in App.xaml.cs in the constructor for it to work.


Don't want to miss updates? Please click the below button!

Follow MindStick