捕捉市场搜索意图? [英] Catching market search intents?

查看:87
本文介绍了捕捉市场搜索意图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想抓住一个Android Market的搜索意图。

I'm trying to catch an Android Market search intent.

这是你推出Android市场和包名称搜索一个应用程序的方式:

That's the way you launch Android Market and search for an app by package name:

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pname:com.google.somepackage")));

现在,这里的意图过滤器对我的活动之一:

Now, here's the intent filter for one of my activities:

<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:scheme="market" android:host="search" />
</intent-filter>

我期望的Andr​​oid问我哪个应用程序应该处理这不会发生的目的。
然而,如果我替换市场市场1 搜索搜索1 ,在这两个地方,我的活动被推出。
是否有贱民的意图或东西的概念?

I'd expect Android to ask me which app should handle the intent which doesn't happen.
Yet, if I replace market with market1 or search with search1, in both places, my activity gets launched.
Is there a notion of "untouchable" intents or something?

TIA。

推荐答案

这是奇数确实还挺违背了全开放的意图系统。我知道有广播只有系统可以创造,但我没有听说过的意图解决这样的事情。

That is odd indeed, and kinda goes against the whole open intent system. I know there are broadcasts that only the system can create, but I hadn't heard of such a thing for intent resolution.

反正,我只是把市场APK在我的HTC Hero和检查清单。他们稍微更具体的在他们的URI匹配通过添加路径:

Anyway, I just dumped the Market APK on my HTC Hero and checked the manifest. They're being slightly more specific in their URI-matching by adding the path:

<intent-filter android:priority="100">
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="http" 
          android:host="market.android.com" android:path="/search" />
    <data android:scheme="market"
          android:host="search" android:path="" />
</intent-filter>

不过,我尝试添加这对我的应用程序,但我增加了优先级值(<一href="http://stackoverflow.com/questions/1960249/intent-filter-with-androidpriority-setting/1977942#1977942">not我见过有之前的任何影响),但我仍然无法捕捉到意图

However, I tried adding this to my app, except I increased the priority value (not that I've seen that have any effect before), yet still I couldn't capture the Intent.

希望有人(或AOSP)可以揭示状况的一些光...

Hopefully someone (or the AOSP) can shed some light on the situation...

这篇关于捕捉市场搜索意图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆