17

私のテストURI文字列は

http://test.host.com/path/test.html?key1=val1&key2=val2

そして、マニフェストにインテントフィルターを作成します

A.スキームとホスト(動作しますが、したくありません)

<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <data
        android:scheme="http"
        android:host="test.host.com"
    />
    <category android:name="android.intent.category.BROWSABLE" />
    <category android:name="android.intent.category.DEFAULT" />
</intent-filter>

B. A & path(pathPrefix, pathPattern) (動作しない)

    <data
        android:scheme="http"
        android:host="test.host.com"

        1. android:path="path/test.html" -> not worked (link to chrome broswer)
        2. android:path="path"           -> not worked (link to chrome broswer)
        3. android:pathPrefix="path"     -> not worked (link to chrome broswer)
        4. android:pathPattern="user/invite.*"  -> same (I do not know pattern)

    />

(path/test.html )

4

3 に答える 3

20

先頭にスラッシュがありません。以下が機能するはずです。

android:path="/path/test.html"

また

android:pathPrefix="/path/test.html"
于 2013-10-16T13:32:41.697 に答える
11

アプリを起動する必要がある場合のみリンクの場合タグのみで属性を/path/test.html使用するandroid:pathdata

<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="http"
        android:host="test.host.com"
        android:path="/path/test.html" />
    <category android:name="android.intent.category.BROWSABLE" />
    <category android:name="android.intent.category.DEFAULT" />
</intent-filter>

Asandroid:path属性は、Intent オブジェクトの完全なパスと照合される完全なパスを指定します。 ただし、 android:pathPrefix属性は、Intent オブジェクト内のパスの最初の部分のみに対して一致する部分パスを指定します。

したがって、android:pathPrefix属性ではなくandroid:path属性を使用する場合、アプリは、、、などで開始される可能性/path/test.htmlがあり/path/test.html?key1=value1ます/path/test.html?key1=value1&key2=value2

データタグのandroid docに関する詳細情報intent-filter

于 2015-05-17T17:17:27.367 に答える
4

この属性は、Intent オブジェクト内のパスの最初の部分pathPrefixのみと照合される部分パスを指定します。

android:pathPrefix="/path/"も機能します。

于 2014-06-05T01:34:06.843 に答える