windows-locationapi

Powershell: Getting GPS Coordinates in Windows 10 - Using Windows Location API?

落花浮王杯 提交于 2019-12-21 05:41:24
问题 I'm looking for a way to gather internal GPS data from a powershell script using Windows Location API, as the Windows Location Platform is no longer able to satisfy the need. Previously, there was a com object to use. Is there a way for this to be accomplished in Windows 10? 回答1: An example of using the System.Device.Location method, this should be what you're looking for. Add-Type -AssemblyName System.Device #Required to access System.Device.Location namespace $GeoWatcher = New-Object System

new LocationTrigger(LocationTriggerType.Geofence) fails with InvalidCastException when registring background task

耗尽温柔 提交于 2019-12-12 03:26:35
问题 I build simple app with usage of geofence api and background task to handle geofence changes. Here is part of code, wich try register background task private async void RegisterBackgroundTask() { const string name = "GeofenceBackgroundTask"; if (BackgroundTaskRegistration.AllTasks.Any(task => task.Value.Name == name)) { return; } var loc = await new Geolocator().GetGeopositionAsync( TimeSpan.FromMinutes(2), TimeSpan.FromSeconds(5)); //needed to trig user acceptance var backgroundAccessStatus