Getting the current Google Maps API Version

Can the current API version be obtained using the ExecuteJavaScript routine? I cannot find any examples on the web and am unaware of a way to obtain them through the Map object.

For example, the FNCGoogleMaps.Options.Version is set to 'weekly', but there isn't a way to know if the map uses Google API version 3.52, 3.53, 3.53.1, etc.

It would be nice to know which version is getting loaded to decide if we want to execute new API features, but I don't know which version is loaded.

Any help would be greatly appreciated.

Hi,

With the Options.Version property you can manually set which version of the API is loaded. There is no need to check. If Options.Version is set to "3.52" this is the version that will be used.

Bart,

I'm aware of that. What I am asking is if I set the Options.Version to "weekly", how can I get what version your program is using? Can't I run a script to get this and if so, how?

This will return the currently loaded API version.

TTMSFNCUtils.Log(TMSFNCMaps1.ExecuteJavaScriptSync('google.maps.version'));

I tried that too - but the line hangs.

I even wrote this function:

function TFTMSMap.GetVersion:string;
var
s,v,AValue: string;
begin
result:='';
s := 'google.maps.version';
try
// AValue:=FNCGoogleMaps.ExecuteJavaScriptSync(s); // Execute Script
TTMSFNCUtils.Log(FNCGoogleMaps.ExecuteJavaScriptSync(s));
except
on e:Exception do
begin
TraceMsg('Error Getting Version Javascript: '+e.Message);
Exit;
end;
end;
result:=AValue;
end;

Please try the following workaround:

procedure TForm1.TMSFNCMaps1MapInitialized(Sender: TObject);
var
 t: ITask;
begin
 t := TTask.Create(
 procedure
 begin
 TThread.Synchronize(TThread.Current,
 procedure
 begin
  TTMSFNCUtils.Log(TMSFNCMaps1.ExecuteJavaScriptSync('google.maps.version;'));
 end);
 end
 );
 t.Start;
end;

image

Thank you!!

That worked perfectly!

image