0

我正在尝试从通过 SMS 或电子邮件发送的 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。

帮我!!!

4

2 回答 2

1

您的意图过滤器是错误的。您提供了错误的方案和主机值。

<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>
于 2015-07-06T06:11:31.127 回答
0

您交换了“主机”和“方案”值..它应该是:

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

然后这个 URLhttp://m.special.scheme/other/parameters/here应该打开你的应用程序......

有关更多信息,请参阅此答案

于 2015-07-06T06:11:12.500 回答