0

I am trying to get the location in a Windows 8 WPF desktop application. The PC has working GPS device.

Issue: Not the current location is returning, instead the last location when a 3rd party location aware application was activated.

I've carefully read the "Getting location in Windows 8 desktop apps" question/answer it seems to be work but with this "feature" which makes that solution unusable. I do not know if this issue is because I missed something or the original concept missed something or this is because we are trying to hack (using WinRT from a Desktop application)

The issue is strange:

The program works as expected, but... The data returned relates to last time the GPS was used by a third party application for example Microsoft BingMaps. So the returned location is not the current.

The base of the solution Geo-location on Windows 8* desktop applications using WinRT

How to use WinRT in a desktop project is described here: Using Windows 8* WinRT API from desktop applications

public partial class MainWindow : Window
{
   public MainWindow()
   {
       InitializeComponent();
       new GpsUtils().UseGeoLocation();
   }
}

class GpsUtils
{
    public async void UseGeoLocation()
    {
        var geolocator = new Geolocator();
        var geoposition = await geolocator.GetGeopositionAsync();
        // work with geoposition. The geoposition returning here is not the current position
    }
}

Missed I something? Any ideas? Thanks in advance

Community
  • 1
  • 1
g.pickardou
  • 32,346
  • 36
  • 123
  • 268
  • first to try rule out the "or this is because we are trying to hack (using WinRT from a Desktop application)" run it in a normal Win8 store app. – Pedro.The.Kid Dec 11 '13 at 17:01
  • Have you tried to use the Sensor API? http://code.msdn.microsoft.com/windowsdesktop/Windows-7-Geolocation-API-25585fac – WiredPrairie Dec 11 '13 at 17:08

0 Answers0