Note: Advice in this article will only work for DotNetBrowser 1.
See the corresponding article for DotNetBrowser 2 here.

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 variablesGOOGLE_API_KEY, GOOGLE_DEFAULT_CLIENT_ID andGOOGLE_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.

Using the BrowserPreferences.SetChromiumVariable(String name, String value) method

For example:

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 Browser instance.

Geolocation Permission

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:

Desktop Notifications and Permission Requests