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