Xamarin Essentials Geolocation

JS_GJS_G USMember ✭✭

Hi,

I am trying to use geolocation https://docs.microsoft.com/en-us/xamarin/essentials/geolocation?tabs=ios to get coordinates in WebKit.WKWebView.

I've below code to load my URL in webview:

public override void ViewDidLoad ()
{
base.ViewDidLoad ();
WebKit.WKWebView webViewWK = new WebKit.WKWebView(View.Frame, new WebKit.WKWebViewConfiguration());
View.AddSubview(webViewWK);
var url = new NSUrl("https://mytest.Com/test.html");
var request = new NSUrlRequest(url);
webViewWK.LoadRequest(request);
}

Please advise how to get location as below before loading the webview request
var myRequest = new GeolocationRequest(GeolocationAccuracy.Medium);
var location = await Geolocation.GetLocationAsync(myRequest);

Sign In or Register to comment.