Location on MS Surface

Looking at Samples\Object Pascal\Multi-Device Samples\Device Sensors and Services\SensorInfo in FMX (and I think the same can be actually done in VCL), the EXE without any modifications to the code gives me different bad results everywhere (either Delphi 10.4 or 11):

  1. On a laptop, if the sensor is OFF in Windows Privacy, it GPFs on start, and if the sensor is ON, it can see it, but reports NAN’s for all values;
  2. On a Surface tablet (Pro 2, Windows Pro 10), it cannot see the location sensor at all, but it can see all the other ones.

Are the sensor classes really all that broken, or is this one Sample is not very good? Or is there any extra software/drivers that need to be installed first?

Anyone is getting successful location results under Windows, FMX or VCL? Win 11 (which 10 will eventually upgrade to anyway)? If it’s supposed to work, what am I doing wrong?

Are you sure your laptop and or surface have a GPS sensor.

I have done some playing with GPS. Testing code on Windows before running on Android.
On Windows had to create a Dummy for GPS values.

Windows Location Has fields such as
FAddress1 := Sensor.Address1;
FAddress2 := Sensor.Address2;
FCity := Sensor.City;
FStateProvince := Sensor.StateProvince;
FPostalCode := Sensor.PostalCode;
FCountryRegion := Sensor.CountryRegion;
Which I think come out of your windows settings and various intrusive monitoring techniques

My current position is available via

Thanks! Trying your examples, it can see the GPS, but reports 0’s too.

Probably need to set up remote debugging and dig deeper, but don’t have time for it now. Will come back to it later. Thanks again!


And under Surface it’s also the same: it cannot even see the sensor.