简体   繁体   English

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

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

I'm trying to open my app from URL which is send either in SMS or in Email. 我正在尝试通过以短信或电子邮件发送的URL打开我的应用程序。 But it will not open my application. 但这不会打开我的应用程序。

Here is the code i have used in AndroidManifest File. 这是我在AndroidManifest File中使用的代码。

 <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>

Here is the URL i have passed in the email 这是我在电子邮件中传递的URL

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

I have also try this m.special.scheme://other/parameters/here 我也尝试过这个m.special.scheme://other/parameters/here

But this will show as a static text in email not as a URL. 但这将在电子邮件中显示为静态文本而不是URL。

Help me!!! 帮我!!!

Your Intent filter is wrong. 您的Intent过滤器错误。 You are providing wrong scheme and host value. 您提供的方案和主机价值不正确。

<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>

You have the "hosts" and "scheme" values swapped.. it should be: 您已交换“主机”和“方案”值..应该是:

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

Then this URL http://m.special.scheme/other/parameters/here should open your app... 然后,该网址http://m.special.scheme/other/parameters/here应打开您的应用...

See this answer for more info. 有关更多信息,请参见此答案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM