简体   繁体   English

Android意图无法使应用程序从浏览器启动

[英]Android intent not working to make app launcheable from browser

I'm trying to achieve this using the following code: 我正在尝试使用以下代码实现这一目标:

    <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>
            <data android:scheme="ttest" />
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.BROWSABLE" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

Clicking 'debug' on Eclipse will launch my app correctly. 在Eclipse上单击“调试”将正确启动我的应用程序。 But going to the browser and typing 'ttest://foo' won't launch the app as expected. 但是进入浏览器并输入'ttest:// foo'不会按预期启动该应用程序。 What's wrong? 怎么了?

I did some tests on an HTC Sensation running ICS, a Samsung running 2.3.3, and a 4.0.3 emulator. 我对运行ICS的HTC Sensation,运行2.3.3的Samsung和4.0.3模拟器进行了一些测试。 I couldn't get any URL intent handling to work on the HTC, but had no trouble with the Samsung or the emulator. 我无法在HTC上进行任何URL意向处理,但对于Samsung或模拟器没有任何问题。 Any chance you're using an HTC phone? 您有使用HTC手机的机会吗? Apparently HTCs have a problem with this: Standard intent URI broken? 显然,HTC对此有疑问: 标准意图URI损坏了?

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

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