2

What is the equivalent of WebView.getUrl() in GeckoView ?

I was using webView.getUrl() for WebView and xWalkView.getUrl() for XWalkView. I would like use GeckoView in my android application, but struck with getUrl part. Could anyone help me ?

Prince Francis
  • 2,995
  • 1
  • 14
  • 22

1 Answers1

3

There's no direct way to get the current URL in GeckoView.

To achieve this, you should track the current URL by overriding the NavigationDelegate.onLocationChange method. You can see an example of this here: https://searchfox.org/mozilla-central/rev/01d1011ca4a460f751da030d455d35c267c3e210/mobile/android/geckoview_example/src/main/java/org/mozilla/geckoview_example/GeckoViewActivity.java#1027

Agi Sferro
  • 626
  • 3
  • 12