How to disable Auto Locking when our windows phone app is running?

396 Views Asked by At

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 ?

Please help me out.

Thanks in Advance.

1

There are 1 best solutions below

0
Rishi Jasapara On

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.