Catching market search intents?

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

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>

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.


Asked by: Darcy280 | Posted: 24-01-2022






Answer 1

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.

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>

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.

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

Answered by: Eric706 | Posted: 25-02-2022



Similar questions

android - Catching Complete action using

Hey, How can I get my application into the Complete action using for Long press of the Search button? I already know that the action is SEARCH_LONG_PRESS, but what do I do with this in the Manifest so that my application will show up in this list?


java - Android - Catching onPause without being the active Activity

Is there any way to catch onPause() in a java class that is Not an activity? I have native code with a Java-helper class that is used in other apps, and whenever those apps enters background I want to prepare for it too. How can I solve this? Is it enough to have my Java class extend some class to get the onPause(), even though its not registered as an activity in manifest etc?


android - Catching when the user pressed the Home Button

I would like to know when the user pressed the home button while he was running my app. BUT: The problem is that I don't want to edite the existing code. meaning I don't want to add logic to the existing activities onPause() method. The only solution I found was to add a service to the application which listens to the Log detecting if there was an intent to run the HOME: Startin...


android - NOT NULL columns in SQLite and error catching

I have a database that is being filled by user defined EditTexts. None of the edit texts should allow empty fields. I know that I can check for this with a couple simple if-statements: if myEditText.getText().toString().equals("") // display error. However I would perfer to use this opportunity to brush up on my SQLite and error catching (as demonstrated in my add method). How would I go about altering...


Android, Catching error in parsing JSON

I can connect to server and get json data. it is in this format: {"clazz":"ManiaContestantList","contestants":[ {"clazz":"ManiaContestant","contestantId":"1","contestantName":"Adira","photoUrl":"/fileFeed.action?service=astroManiaService&amp;action=viewFile&amp;type=JPG&amp;path=1/1_CONTESTANT_PHOTO.png"}, {"clazz":"ManiaContestant","contestantId":"2","contestantName":"Akim","photoUrl":"/fileFe...


android - Catching spinner item click when there is only one item listed

I'm trying to do something which wasn't the spinner specially made for. I got list that changes dynamically. I need to catch onSelectedItemClick when the user choses the item. Problem occurs when there is only one item in the spinner adapter. Selecting it (or rather reselecting, since it was selected already) won't fire OnSelectedItemListener. How could I catch it otherwise?


android - catching a call to exit app

I have an Activity that extends phonegap, and in a js file there is a call to navigator.app.exitApp that ends the activity. I want to capture this call on my activity to present an exit dialog. I'm not familier with PhoneGap and JS. How can i catch the call to exitApp? Thank You.


android - If/else not catching inside method on button press

So I've got a method that runs on a button press and everything comes up perfect except where I have a bit of an internal if/else if/else loop. I'm sure it's something stupid I'm missing but I just can't seem to see it. In the code below I've got it finding the hourtype but even when I set it to false directly the if/else doesn't trigger. It's able to get the hour int just fine but it won't subtract 12 from it lik...


android - Catching outgoing calls in a service

I am trying to catch an outgoing call in a service and by now I would expect something in the debugger console. I create a DailerReceiver (who is added in the manifest and extends the BroadcastReceiver). Then I add an IntentFilter with android.intent.action.NEW_OUT_GOING_CALL and register the receiver. Also I enable the service in the manifest. I expect those are ...


android - IME and catching (touch) events

Im currently trying to get my diploma in psychology and i want to write about different types of keyboards for smartphones. To research this area i need a tool that measures times. As Im new to Android programming, my friend is helping me, but we got stuck. Here is what we need, and what we tried. Id really appreciate any help =) We need a way to call a function before user input in IME begins and...






Still can't find your answer? Check out these communities...



Android Google Support | Android Community | Android Community (Facebook) | Dev.io Android



top