Catch market searches?

I am trying to catch the intention of searching the Android Market.

What you launch Android Market and are looking for an application by package name:

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

Now, here is an intent filter for one of my actions:

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

I expect Android to ask me which application should handle an intent that is not happening.
However, if I replace market with market1 or search with search1 , in both places my activity starts.
Is there a concept of β€œuntouchable” intentions or something else?

TIA.

+6
android android-intent
source share
1 answer

This is really strange, and the curious contradicts the whole open system of intentions. I know that there are broadcasts that only the system can create, but I have not heard about this to resolve intentions.

In any case, I just dropped the Market APK on my HTC Hero and checked the manifest. They are a little more specific in their URI mapping, adding a 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> 

However, I tried to add this to my application, except that I increased the priority value ( not what I saw, which has an effect before ), but still I was not able to capture Intent .

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

+8
source share

All Articles