深层链接未打开应用程序活动

时间:2017-11-13 12:51:04

标签: android android-webview

我使用下面的代码打开我的活动

<activity
        android:name=".home.AddConferenceActivity"
        android:label="@string/add_conference"
        android:parentActivityName=".home.ConferenceActivity"
        android:screenOrientation="portrait">

        <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:host="cokeconference.com"
                android:pathPrefix="/info"
                android:scheme="cokeconference" />
        </intent-filter>
    </activity>

,网址为:cokeconference://cokeconference.com/info/Akshat/1234567891

我尝试了两种类型的HTML文件(也包括Java脚本),如下所示:

<!DOCTYPE html>
<html>
<body>
    <script language="javascript">
        window.location =      'cokeconference://cokeconference.com/info/Akshat/1234567891';
    </script>
</body>
</html>

 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"      "http://www.w3.org/TR/html4/strict.dtd">
<HTML>
 <HEAD>
  <TITLE>Base element example</TITLE>
   <a href="cokeconference://cokeconference.com/info/Akshat/1234567891"> Test     Conference Info </a>

</HEAD>

我哪里错了? 在此先感谢

2 个答案:

答案 0 :(得分:0)

这就是我的意思。及其工作

       <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" /> // accept http and https
            <data android:scheme="https"/>
            <data android:host="www.website.com" /> //your host
            <data android:path="/*" /> // detect any path with your host
        </intent-filter>

答案 1 :(得分:0)

替换:

<data
    android:host="cokeconference.com"
    android:pathPrefix="/info"
    android:scheme="cokeconference" />

有了这个:

<data android:scheme="cokeconference" />
<data android:host="cokeconference.com" />
<data android:pathPattern="/info/.*/.*" />