title: How to debug background location agents in Windows Phone 8
body: <p>I'm currently developing an app where the device's location should be send to a server. I've worked through <a href="http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj681691%28v=vs.105%29.aspx" rel="nofollow">the MSDN articles</a> on the background agents and accessing the location. This works so far. My location is transmitted to the server when I've triggered a location change which is farther away than the set MovementThreshold.</p>
  
  <p>However, I've read that testing of background agents can be complicated. If you use the Emulator, you can easily change your device's location very often. But on a real phone, location background services are limited in their idle runtime to 30 minutes and execution of commands should only take up to 25 seconds. Background agents can also be disabled by the user from the phone's settings screen. They are also deactivated, when the agent crashes more than two times in a row. Another limitation is that <a href="http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj681691%28v=vs.105%29.aspx" rel="nofollow">inactive background agents are stopped after 4 hours</a>, if <a href="http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202942%28v=vs.105%29.aspx#BKMK_ConstraintsforallScheduledTaskTypes" rel="nofollow">they don't update an apps live tile</a>.</p>
  
  <p>My app updates a live tiles counter, so I think my background agent should be running up to 14 days without restart from my app. I've tested the app from yesterday to today and saw the background agent running (when looked up from the settings). There was also the small dot in the upper bar visible, indicating that a programm is accessing the phones geo location. However, sometimes the dot vanishes and my background agent is killed for no obvious reasons.</p>
  
  <p>Therefore my question are:</p>
  
  <ul>
  <li>How can I reliable test geo location on a real device without the need to travel with phone and attached debugging laptop?</li>
  <li>How can I test in a timely manner for the timeout scenarios I've mentioned (30 min, 4hrs, 14 days)?</li>
  <li>How can I check for these two crashs of the background agent?</li>
  </ul>