通过短信链接启动安卓应用程序

5
我已经阅读了其他有关此问题的所有帖子,但都没有解决我的问题。显然,链接的方案必须是http,否则在短信中无法点击。
如果我使用其他人发布的内容并单击http链接,则会提供以下选项:
打开网址、添加到书签、复制消息文本
如果我打开URL,则只能选择浏览器,没有其他选项。
我需要它打开应用程序,而不是提供浏览器选项。
请帮忙。
XML:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.testapp"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="15" />

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".MainActivity"
        android:label="@string/title_activity_main" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

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


从Android文档中:注意:Android框架中的方案匹配区分大小写,与RFC不同。因此,您应始终使用小写字母指定方案。 ... 而且你有 android:scheme="Http" ... 无论如何它都会询问用户要运行哪个应用程序,除非用户选择默认操作... - Selvin
更改了它,但仍无法打开应用程序或提供打开应用程序的选项。 - David
我在SGS2和2.3.3模拟器上测试,至少对我来说(使用小的http/https),它是正常工作的。 - Selvin
我在我的 SGS2 和 SGS3 上尝试过。 - David
@David:用这种方式,它仍然显示浏览器选项,对吧?有没有一种方法可以直接打开我的应用程序,而不给出浏览器的选项呢? - Shobhit Puri
显示剩余2条评论
1个回答

3
如果你复制粘贴了代码,则可能存在拼写错误:
catagory应该像这样写成category:
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/> 

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接