【问题标题】:Android intent not working to make app launcheable from browserAndroid意图无法使应用程序可从浏览器启动
【发布时间】:2012-10-21 20:12:42
【问题描述】:

我正在尝试使用以下代码实现此目的:

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

在 Eclipse 上单击“调试”将正确启动我的应用程序。但是转到浏览器并键入“ttest://foo”不会按预期启动应用程序。怎么了?

【问题讨论】:

  • 如果将android:host="*" 添加到data 标记中,是否可以解决问题?
  • @Eric 它不起作用...当我在 Android 浏览器上键入“ttest://foo”时,它会进入谷歌搜索,即使在(我认为)安装了具有该意图的应用程序之后-filter,通过单击 Eclipse 上的调试。

标签: android android-intent


【解决方案1】:

我在运行 ICS 的 HTC Sensation、运行 2.3.3 的三星和 4.0.3 模拟器上进行了一些测试。我无法在 HTC 上进行任何 URL 意图处理,但在三星或模拟器上没有问题。你有机会使用 HTC 手机吗?显然 HTC 对此有问题:Standard intent URI broken?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-06-05
    • 2012-06-20
    • 1970-01-01
    • 2012-08-21
    • 1970-01-01
    • 2013-02-05
    相关资源
    最近更新 更多