Deploying your application
An application that uses the component needs, on the machine where it runs:
| WebView2Loader.dll | In the same folder as the executable: the 32 bit one for a Win32 application, the 64 bit one for a Win64 one. They are in the repository, under Demo\GoogleMaps\Bin\Win32 and Demo\GoogleMaps\Bin\Win64. With DPM they are copied next to the executable by the package |
| WebView2 Runtime | The Microsoft Edge WebView2 Runtime. It comes with Microsoft Edge on Windows 10 and 11; where it is missing, install the Evergreen Runtime from Microsoft |
| Internet | The map and its services (geocoding, directions) are Google's, served online |
| A temporary folder | Where WebView2 keeps its data: see RegisterUserDataFolder |
The data folder of WebView2
By default WebView2 puts its data folder next to the executable, which is not writable when the application is installed in Program Files. Register a folder where the user can write, before the first map is shown:
TEdgeGoogleMapViewer.RegisterUserDataFolder(
TPath.Combine(TPath.GetTempPath, ExtractFileName(ParamStr(0))));When the map does not start
If the first call that shows the map raises "Error: cannot initilize Google Map Viewer!" followed by "Check if webview2loader.dll is present in System Path or Application Path", the loader is not found, or it is the wrong bitness: a 64 bit application cannot use the 32 bit DLL.
The API key
The key is part of the page that the browser loads: do not rely on it being secret. In the Google console restrict it to what your application needs (the Maps JavaScript API, geocoding and directions), and set a quota. Read it from a configuration file or from the settings of the user rather than from a constant in the source.