I've been playing with app links with a test example but it's not working in my case.
I've created two html files source.html and some_html_file.html within the assets directory.I'm loading source.html file within a webview and that has button and I'm navigating to some_html_file.html using that button. See the source you'll get to know what I'm doing here.
source.html
<html>
<form name = "type_1" action="some_html_file.html">
<input type="submit" value="Example 1 - open some html file"/>
</form>
<form name = "type_2" action="example2://node/news/23">
<input type="submit" value="Example 2 - go to news 23"/>
</form>
</html>
some_html_file.html
<html>
<head>
<meta property="al:android:url" content="example://node/news/23" />
<meta property="al:android:package" content="com.example.uritest" />
<meta property="al:android:app_name" content="UriTest" />
</head>
<h3>This is uri test page.</h3>
</html>
Problem
So clicking the first button, I'm expecting that android os should read the <meta>
tags of the target html file and will show my activity which has the logic to handle the intent.
AndroidManifest.xml
<activity android:name=".HandleUriActivity">
<intent-filter>
<data
android:scheme="example"
/>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<data
android:scheme="example2"
/>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
Any help would be appreciated.
From the logcat I can see that -
D/WebViewCallback: shouldOverrideUrlLoading=file:///android_asset/some_html_file.html? W/WebViewCallback: No application can handle file:///android_asset/some_html_file.html?
Update :
I've updated my question. I've just added one more form with action. Check form type_2 in source.html. Button is Example 2 - go to news 23 is working fine and I'm getting the following data on HandleUriActivity activity.
host = node
authority = node
path = /news/23
My question is how do I work with the first case i.e. android os should open my activity while opening a page(some_html_file.html) that has meta-data tags.
Update #2:
I do agree with you @Eric B. But It is not working if I've a different app.
I've a webpage with the following meta data on my test website.
<head>
<meta property="al:android:url" content="example://node/news/23" />
<meta property="al:android:package" content="com.example.uritest" />
<meta property="al:android:app_name" content="UriTest" />
</head>
When I'm opening this page within Google Chrome, Chrome didn't show my app. It directly opens the webpage.