How do I get only my domain links to open my application?

1

If I click on a link related to my site, I'd like the list of applications that can open that link (Google Chrome, UC Browser and etc.) to appear as well, which is a very simple browser that works using a WebView, but only when it's a link to my site .

This is the code for my app:

mWebView = (WebView) findViewById(R.id.webview);
mWebView.loadUrl("http://google.com.br");
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setSupportZoom(false);
mWebView.setWebViewClient(new LinkWebViewClient());

Does anyone have clues on how to do this?

    
asked by anonymous 28.07.2016 / 16:17

1 answer

2

You have to change the intent-filter , which is in Manisfest.xml, of activity that will respond to intent , for something like this:

>
<intent-filter>

    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="http" />
    <data android:host="oSeuDominio.???" />
    <data android:host="www.oSeuDominio.???" />
    <data android:pathPattern="/.*" />

</intent-filter>  

Replace oSeuDominio.??? according to your domain.

    
28.07.2016 / 18:48