DotNetBrowser is based on the Google Chromium engine. Some Chromium features use Google APIs. To access those APIs, an API Key is required. To acquire API Key follow the instruction.
Geolocation is one of those Chromium features that uses Google API. You must enable Google Maps Geolocation API and billing, otherwise, Geolocation API will not work. Once you enable Google Maps Geolocation API and billing, you can provide the keys to DotNetBrowser Chromium engine:
Via environment variables
Set the environment variables
GOOGLE_DEFAULT_CLIENT_SECRET to your "API key", "Client ID" and "Client secret" values respectively. To find out where to get "API key", "Client ID" and "Client secret" see the video instruction.
BrowserPreferences.SetChromiumVariable(String name, String value) method
BrowserPreferences.SetChromiumVariable("GOOGLE_API_KEY", "Your API Key"); BrowserPreferences.SetChromiumVariable("GOOGLE_DEFAULT_CLIENT_ID", "Your Client ID"); BrowserPreferences.SetChromiumVariable("GOOGLE_DEFAULT_CLIENT_SECRET", "Your Client Secret");
You must configure Chromium variables before creating any
Please take into account that there is a specific permission that should be granted to enable geolocation in DotNetBrowser.
The following article describes how to handle Browser permissions: