'Webview open link in app loads main page, not link

When the webView application installed touch on links example.com are detected from browser, but when choose open in app, opens app and loads main page, not link

<intent-filter>
   <action android:name="android.intent.action.MAIN" />
   <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:autoVerify="true">
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="@string/scheme" />
</intent-filter>
 <intent-filter android:autoVerify="true">
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE"/>
    <data android:scheme="https" android:host="@string/domain" />
    <data android:scheme="https" android:host="@string/domain_nw" />
    <data android:scheme="http" android:host="@string/domain" />
     <data android:scheme="http" android:host="@string/domain_nw" />
 </intent-filter>

Links skatehype://example.com is working (tested but not used yet) Links https://example.com/xxx opens app in main page (or any link)

If I try to set path or pathPrefix android:pathPrefix="/.*" Causes browser don't ask for "open in app"

How can I redirect to the right url when open in app link?

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        super.getWindow().requestFeature(Window.FEATURE_PROGRESS);

        /*...*/

        if (getIntent().getData() != null) {
            String path     = getIntent().getDataString();
            aswm_view(path);
        }
    }


Solution 1:[1]

Solved! I was loading start_url when application loads. Justa ask for .getData before it.

public void run() {
  if (getIntent().getData() != null) {
    String path = getIntent().getDataString();
    aswm_view(path);
  } else {
    aswm_view(ASWV_URL); //Rendering the default URL
  }
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 skatehype