---
title: "How to disable Auto Locking when our windows phone app is running?"  
description: "How to disable Auto Locking when our windows phone app is running?"  
author: "Samuel Fernandes"  
published: 2015-04-07  
updated: 2015-04-07  
canonical: https://www.mindstick.com/forum/23083/how-to-disable-auto-locking-when-our-windows-phone-app-is-running  
category: ".net"  
tags: ["windows phone"]  
reading_time: 1 minute  

---

# How to disable Auto Locking when our windows phone app is running?

I am developing a [windows](https://www.mindstick.com/articles/311752/how-to-install-and-use-the-google-wifi-software-on-a-windows-or-mac-computer) [phone app](https://www.mindstick.com/forum/23080/windows-phone-app-approval-process) in which i fetching some data from [service](https://www.mindstick.com/articles/105963/online-thesis-writing-service-for-college-kids-with-disabilities) at that moment the [device](https://www.mindstick.com/blog/149/retriving-network-device-information-in-c-sharp) will go to auto lock since it is un - [responsive](https://www.mindstick.com/blog/11940/tips-for-fast-responsive-web-design-in-2018) for long time.

so , how can i avoid this auto [locking](https://www.mindstick.com/interview/1890/what-is-difference-between-optimistic-and-pessimistic-locking) in the windows phone app when some [process](https://yourviews.mindstick.com/story/1525/7-important-factors-that-may-affect-the-learning-process)/fetching/syncing is happening with services.

i am not able test this [scenario](https://yourviews.mindstick.com/view/81221/sports-will-change-the-education-scenario) since i am [testing](https://www.mindstick.com/articles/1849/role-of-testing-in-software-development) it on an emulator.

1) how to avoid auto locking [feature](https://www.mindstick.com/articles/12788/how-to-boost-sales-using-magento-2-checkout-feature) in windows phone app when it is running? 2) What are the various possible ways in which i can do this ?

## Replies

### Reply by Anonymous User

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.


---

Original Source: https://www.mindstick.com/forum/23083/how-to-disable-auto-locking-when-our-windows-phone-app-is-running

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
