Dave, that has allowed me to tidy up the code a bit I hope, but now it just
prangs out with android telling me that there is a bug in the programme!
//Snip
type
TExperimentalLocationMainForm = class(TForm, IFusedLocationOwner)
ButtonStart: TButton;
ButtonStop: TButton;
Memo1: TMemo;
procedure ButtonStartClick(Sender: TObject);
procedure ButtonStopClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure LocationReceived(const ALocation: JLocation);
procedure LocationUpdatesChange(const AIsActive: Boolean);
constructor Create(AOwner: TComponent);
end;
var
ExperimentalLocationMainForm: TExperimentalLocationMainForm;
FFusedLocation: IFusedLocation;
FusedLocationOptions : tFusedLocationOptions;
//Snip
procedure TExperimentalLocationMainForm.LocationReceived(const ALocation: JLocation);
begin
Memo1.Lines.Add('Latitude ' + Format('Latitude: %f12.7, Longitude: %f12.7, Accuracy : %f5.2',
[aLocation.getLatitude, aLocation.getLongitude, aLocation.getAccuracy]));
end;
//Snip
procedure TExperimentalLocationMainForm.ButtonStartClick(Sender: TObject);
begin
if FFusedLocation = nil then
FFusedLocation := TFusedLocation.Create(Self, True);
FusedLocationOptions.Interval := 1000;
FusedLocationOptions.Priority := TJLocationRequest.JavaClass.PRIORITY_HIGH_ACCURACY;
FFusedLocation.SetOptions(FusedLocationOptions);
FFusedLocation.Start;
end;
procedure TExperimentalLocationMainForm.ButtonStopClick(Sender: TObject);
begin
FFusedLocation.Stop;
end;
//Don't think the constructor ever gets called.
constructor TExperimentalLocationMainForm.Create(AOwner: TComponent);
begin
inherited;
FFusedLocation := TFusedLocation.Create(ExperimentalLocationMainForm, True);
end;
end.
Thanks, Graham. However, after about 90 hours of work and failing to get the FusedLocation stuff to run, I have given up on it and gone back to plain GPS. Unfortunately, as I finally found in a little footnote in the help pages, if you want to get accuracy from locationlistener stuff you have to use IOS. (Wondered why I wasn’t getting a useful value!) So, despite the fact that the government want accuracy information in the GPS recordings, they are just going to have to put up with the basic GPS stuff until some of this coimplexity gets resolved. Sigh!
Dave, thanks for all your efforts. I have resigned it to the “too hard” basket, and the department can live without “accuracy” on its data! I will look at it in the future.