I have a screen with the:
LocationSensor: TLocationSensor;
And code:
procedure Tfrm.FormCreate(Sender: TObject);
begin
LocationSensor.Active := True;
end;
procedure Tfrm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
LocationSensor.Active := False;
Action := TCloseAction.caFree;
end;
procedure ShowLocation();
var
mapPosition: TMapCoordinate;
begin
frm := Tfrm.Create(Application);
try
mapPosition := TMapCoordinate.Create(frm.LocationSensor.Sensor.Latitude, frm.LocationSensor.Sensor.Longitude);
ShowMessage(FloatToStr(frm.LocationSensor.Sensor.Latitude) + ' | ' + FloatToStr(frm.LocationSensor.Sensor.Longitude));
finally
frm.Show;
frm.BringToFront;
end;
end;
When I call ShowLocation(); in Android 12, it returns 'NaN | NaN' first time, after that each calling returns correct coordinates.
Is it a known issue or did I miss something?