nimi
nimi

Reputation: 606

How can I get the URL from the default browser to use in my custom browser?

I am developing an Android app in which a type of browser will be included. As the user tries to open a URL, an intent resolver asks the user whether they want to complete the action using the default browser or a custom browser. This part of my app is completed. Now I want to ask, if the user chooses to open the link in my custom browser, how can I access that URL?

Currently, if the user chooses my browser they got blank web view, as I am unable to get the URL which I have to open in my webview.

Upvotes: 0

Views: 812

Answers (2)

CommonsWare
CommonsWare

Reputation: 1006539

If the user chooses to open the link in my custom browser, how can I access that URL?

Call getIntent().getData() to get the Uri the user is trying to open.

Upvotes: 1

Chris Stratton
Chris Stratton

Reputation: 40337

If your custom browser is starting in response to an intent, the target URL should be contained in that intent for you to extract.

Upvotes: 0

Related Questions