HOW TO DISABLE AUTO LOCKING WHEN OUR WINDOWS PHONE APP IS RUNNING?

Samuel Fernandes

Total Post:159

Points:1117
Posted by  Samuel Fernandes
 729  View(s)
Ratings:
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 ?

  1. Mayank Tripathi

    Post:397

    Points:3117
    Re: How to disable Auto Locking when our windows phone app is running?

    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.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!