GetGeoPositionAsync Throws an Exception RRS feed

  • Question

  • Hi,

    Using the following code throws exception

                this.geolocator = new Geolocator();
    currentLocation = await   this.geolocator.GetGeopositionAsync();

    Exception Thrown is : "Error HRESULT E_FAIL has been returned from a call to a COM component."

    Location Capability is already added in Appmanifest.

    Tried it on : [Windows 8.1 VS professional 2013]

    Any thoughts why this is happening.

    Thank You

    Friday, April 11, 2014 9:00 PM

All replies

  • From where do you call this?

    The user has to grant explicit permission to get the location. This means the first call to GeoLocator.GetGeopositionAsync needs to be done from a UI thread so the consent dialog can show. See the remarks in the Geolocator class documentation.


    Saturday, April 12, 2014 1:01 AM
  • Hi Rob,

    Yes the call to GetGeoPositionAsync is on the UI thread. I even tried the MSDN sample it was also throwing the same exception.

    But I found that , it works just fine when PC is connected to internet using WIFI adapter. 

    Its not working if the PC is connected using Ethernet adapter(Wired connection).

    Any Thoughts why this is happening. 

    Thank You

    Wednesday, April 16, 2014 5:43 PM