How to stop Windows Phone 7 from locking screen? - visual-studio-2010

The application could not be launched for debugging. Ensure that the
target device screen is unlocked and that the application is installed.
How to get rid of this annoying message which appears every time I try to debug or run project from Visual Studio on Windows Phone 7 after 5 minutes of not-using phone (5 minutes is maximum time of sreen time-out I can set in phone settings).
I am missing something? Is it possible to avoid phone form locking/time-outing screen either from VS at start of debugging or in special application that I would manually start first before debugging so that app will be back on screen when debugging is finished and stopping phone from locking screen? But how to stop phone from locking screen? :-)
UPDATE: I have Omnia 7 which is AMOLED and doesn't have "never" setting. According to J. Loomis said in comment below, this is because "they can get severe burn in if left sitting on for extended periods" so best would be to unlock screen programmatically on start of debugging. I think this should work this way in VS.

In "Settings" select "lock & wallpaper" turn the password off and set "Screen time-out" to never.
It is important to note that the "never" option will only show if the password switch is set to off.

you can set UserIdleDetectionMode = Disabled to prevent the lockscreen from coming down on your app while debugging/developing/testing. Use it with caution in your released app. See MSDN for details:
http://msdn.microsoft.com/en-us/library/microsoft.phone.shell.phoneapplicationservice.useridledetectionmode(VS.92).aspx

My phone (Lumia 800) does not have a setting for "Never" in lock+wallpaper settings, even with the password turned off. The only way I could get the phone to stop locking between debugging sessions is to have another app running in the background behind the app you are debugging that has UserIdleDetectionMode set to disabled. There is an app in the marketplace whose sole purpose is this call Phone! Dont Sleep! (note: I did not make this app nor do I know who made it, I am just sharing because I found it helpful)

Related

Windows Phone XNA Games Hangs on Resume when Guide is Visible on WP7.x

My Windows Phone XNA game calls Guide.BeginShowKeyboardInput to get the user's name. While the Guide's input screen is shown, if the user presses the Home or Search (hardware) buttons, the game is deactivated as usual - but if the user then presses the Back (hardware) button, the game should resume but it doesn't. Instead it shows the "Resuming..." message until Windows Phone gives up trying to resume the game and kills the process.
Please note:
My app is failing Microsoft certification because of this problem - I really need to fix it!
This only happens in my game when the Guide input screen is shown - when it's not shown, the game
resumes properly after being deactivated.
This problem only occurs when the game is run on WP7.x (verified problem on WP7.5 and
WP7.8) - although the game seems to resume properly on WP8 devices.
I've created a blank XNA game project, called Guide.BeginShowKeyboardInput and tested it using WP7.x devices, and this problem-behavior doesn't occur.
I've tested the game without enabling Music & my Trial License manager (they use timers) and it still does this.
Exact same behavior occurs in the emulator (resume-failure on WP7.x emulators, works fine on WP8
emulator)
I used threads to asynchronously download content during the loading screen - but they already completed and exited.
I don't believe other threads are running, although this seems like
it could be a thread-blocking issue.
Any other ideas on what could be blocking the game from resuming when the Guide.IsVisible or how to debug/resolve this problem?
The solution to this issue was simply to NOT use SuppressDraw when dealing with any operation that passes control outside of the app, e.g. Launchers, Choosers and the Guide.
Have you tried calling "Guide.EndShowKeyboardInput" in either the Deactivating or closing events?
So that the guide is closed before the app suspends, you do get 10 seconds to suspend so this might be worth looking into.
If you want the guide to re-show on resume, then in your state saving code just have a flag and open the guide if it's set.

GPS based application not running under lock screen in windows phone

I have developed a windows phone application and it works fine when it is open and running actively.
It tracks the user movements on the map and shows the position moves with push pins.
Now I want to ensure that the same application runs even the phone is locked when this app was open.
I have added the below code for it to work under lock screen. After this when I verified the app I realized it is not running when the application is locked.
Is there any other change I need to make to get this work under lock screen.Any help would be greatly appreciated.
private void initiliazesettings()
{
PhoneApplicationService.Current.UserIdleDetectionMode =
IdleDetectionMode.Disabled;
}
To have your app running under lock screen on Windows Phone 7.0/7.1/8.0, you need to set ApplicationIdleDetectionMode, not UserIdleDetectionMode. See details here.
Supossing you placed the method in the right place, that code only keeps the screen on, but doesn't make your app run in background when the lock screen is activated. Windows Phone 7 apps cannot run in background, they get tombstoned.
For Windows Phone 8 this is possible - see the sample here from MSDN.
However for Windows Phone 7/7.1 you can't do this.
You can prevent the screen from locking due to the user not interacting with it (as your code shows). However if you manually lock the screen the app will still be made dormant or tombstoned and your location code won't run.
Your only other option is to use a scheduled background task to read the location of the phone, but bear in mind that this is far from real time data (it is a cached location and you only run once every 30 minutes in the best case scenario).

Is there an analogue of Windows Phone 'User Idle Detection' in Windows 8?

I've used the following code on Windows Phone 7 and 8 to disable user idle detection when my App is displaying data to the user and they are unlikely to interact with the screen e.g. A recipe App where the screen needs to stay on:
http://msdn.microsoft.com/en-us/library/microsoft.phone.shell.phoneapplicationservice.useridledetectionmode(v=vs.92).aspx
Does anyone know if there is an analogue of this available for Windows 8 applications? My tablet app has the same requirement to disable the screen turning off. I haven't managed to find anything :-(
Many thanks,
Jon
You should use the DisplayRequest class, specifically DisplayRequest.RequestActive for this purpose. You must also remember to call DisplayRequest.RequestRelease once you are done to allow the display to sleep, for example, if you are not viewing a recipe, or you are in a menu screen, etc.

Debugging mobile software in the VS device emulator - app switching to background

I have this issue when debugging mobile apps on the emulator. When I press F5, the build starts, then the deploy, then the app pops up in the emulator.
Because this takes a minute or 2, I am checking my SO score and maybe ask a question while I wait, and the emulator is in the background. When I finally switch back to the emulator, it shows the start page, not my app.
I figured out that by pressing the back button I can bring the debugged application to the foreground, but still, I don't know what is pushing it into the background to begin with. Has anybody noticed this, and found a way to prevent it?
The default behavior in WinMo is that if the device has no activity for a certain period of time (set in Settings->Today->Items->Today Timeout), the Today screen will come to the fore. Check to see if that's what's happening (though I think the smallest interval is still larger than a couple minutes).

Emulate Sleeping Windows Mobile Device

Is it possible to emulate a device sleeping and waking using the Microsoft-supplied device emulators?
Yes, but you have to generate your own emulator image with a modified kernel (changing OEMPowerOff). Bruce Eitman blogged about it here. You didn't detail your needs, so it's hard to say, but you might be able to provide some form of simulation by manually setting the named power management events.
This is an old thread, but in case anyone else stumbles across it, you can make the Windows Mobile emulators 'sleep' and wake up, though not with the debugger attached.
Close the emulator window while your application is running and save the state. Or, configure power management to sleep the emulator at the desired time; the emulator will close and save its state automatically. If the debugger is attached, it will lose its connection and stop debugging.
Open Device Emulator Manager and click Refresh until the emulator shows up as disconnected (no icon next to it). Right-click on the emulator name and select Connect.
Emulator wakes up and reappears. If your application is listening for the wake-up notification, it will be signaled at this point.
You can also wake up the emulator using Debug > Attach to Process, though this does not always succeed. Either way, by the time the debugger attaches, the wake up sequence will already have executed. If you can get by with debug statements, though, this is easier than modding the emulator image.

Resources