无法使用自定义 URI 方案从 URL 打开应用程序

Not able to open tha app from URL using Custom URI scheme

我正在尝试从 URL 打开我的应用程序,该应用程序通过短信或电子邮件发送。但是它不会打开我的应用程序。

这是我在 AndroidManifest 文件中使用的代码。

 <activity
        android:name=".TestActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <data
                android:host="http"
                android:scheme="m.special.scheme" />

            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
        </intent-filter>
    </activity>

这是我在邮件中传递的URL

http://m.special.scheme/other/parameters/here

这个我也试过了 m.special.scheme://other/parameters/here

但这将在电子邮件中显示为静态文本,而不是 URL。

帮帮我!!!

您交换了 "hosts" 和 "scheme" 值。它应该是:

<data android:host="m.special.scheme" android:scheme="http"></data>

然后 URL http://m.special.scheme/other/parameters/here 应该会打开您的应用...

有关详细信息,请参阅 this answer

您的 Intent 过滤器有误。您提供的方案和主机值有误。

<activity
        android:name=".TestActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <data
                android:scheme="http"
                android:host="m.special.scheme" />

            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
        </intent-filter>
    </activity>