Geolocation sample

The Geolocation sample demonstrates how to use the Geolocation API to get the geographic location of the user's PC.

 
 
 
 
 
(20)
44,304 times
Add To Favorites
4/9/2013
E-mail Twitter del.icio.us Digg Facebook
Sign in to Ask a Question


  • Class Not Registered
    1 Posts | Last Post February 13, 2013
    • When i run the app it give me Class Not Registered Output every time ...... 
  • How do you fix the Access Denied error?
    1 Posts | Last Post December 15, 2012
    • My app keeps getting denied certification b/c the Microsoft tester disables the Geolocation feature and an access denied error is thrown.
      
      You can easily replicate this in the sample, by not authorizing the GPS prompt on scenario 2.  You cannot fix this by putting a try/catch nor do any of the statuses help (at least that I am aware of).  Can we just fix this bug by updating the API to throw an error in the promise rather than throwing an exception?
  • how about background task less than 15 mins
    1 Posts | Last Post November 29, 2012
    • Any solution for the periodic task < 15 mins?
  • Error HRESULT E_FAIL has been returned from a call to a COM component.
    4 Posts | Last Post November 01, 2012
    • I am getting this error while using Geolocation code below - 
      
      _cts = new CancellationTokenSource();
      CancellationToken token = _cts.Token;
      // Carry out the operation 
      Geoposition pos = await _geolocator.GetGeopositionAsync().AsTask(token);
      
      Also, the Bing Map just shows BETA and nothing else appears. Am I doing something wrong?
      
      
    • I'm also getting this exception.  It appears to be happening for every location aware application on my machine.  Any ideas?
    • 1. This must be global. The geolocation sample no longer works on my Windows 8 Enterprise install, whereas it worked for the last 2 months. My app also no longer works. A fix would be nice, since I am nearly done and need to submit my app to the Windows Store.
      
      "Error HRESULT E_FAIL has been returned from a call to a COM component."
      
      2. The word BETA on the map means you need to upgrade your Bing Maps SDK to the production version.
      
    • Update: I tried on my home Windows 8 Pro and the geolocation sample works. No error.
  • I tried to build and run the sample the following error poped up
    2 Posts | Last Post October 31, 2012
    • An unhandled exception of type 'System.UnauthorizedAccessException' occurred in GeolocationCS.exe
      
      WinRT information: Failed to initialize the application object
      
      Additional information: Access is denied.
    • I got this error when my app wasn't registering the "Location" capability in the Package.appxmanifest file. 
      
      1. Ensure location is checked.
      2. Uninstall your app completely (From the start screen, and you may want to click "Uninstall and then re-install my package" in Project->Properties->Debug.
      3. Try again.
  • Why does the permissions switch not work twice?
    2 Posts | Last Post September 15, 2012
    • load app and "Get Location", ensure it works.
      Use Charms/Settings to disable the Location permission.
      Hit "Get Location", ensure it reports Disabled.
      Use Charms/Settings to enable the Location permission.
      Hit "Get Location", note it still reports Disabled.
      Shut and reload app.
      Hit "Get Location", note it now reports correctly.
      
      For even more fun disable the Location permission.
      Shut and reload app.
      Hit "Get Location", ensure it reports Disabled.
      Use Charms/Settings to enable the Location permission.
      Hit "Get Location", note it reports correctly.
      Use Charms/Settings to disable the Location permission.
      Hit "Get Location", note it is not Disabled.
      
      same result with simulator
      
      is this a problem with the code sample or Windows 8 ?
    • To fix this issue, make sure that you have no other instances of geolocator dangling in memory. I.e. when it's no longer required, do:
      geolocator.removeEventListener(...);
      geolocator = null;
      BUT! if you try to remove an event listener inside the onstatuschanged the app will freeze. Instead you can remove event listeners using setTimeout(..., 1);
  • Retrieve the CivicAddress
    2 Posts | Last Post October 20, 2011
    • Hi,
      
      It is not possible to retrieve the CivicAddress with "Windows Location Provider sensor" in Windows 8 ? The variables are always empty. 
      
      It works with "Geosense Location Sensor".
      
      Perhaps I forget something !
      
      Thanks in advance.
    • Windows Location Provider does not provide CivicAddress information in current release. You'll need a third party provider.