Global search app

by neuromit » Wed, 15 Dec 2010 06:21:00 GMT


Sponsored Links
 I would like to write an application that replaces the dialog that
shows up when you long press the search button. How would I making it
so my app gets launched on a search button long press?

-- 



Re: Global search app

by TreKing » Wed, 15 Dec 2010 06:28:41 GMT


 



Apps get launched (or given as an option to be launched) when they match the
intent being processed. So if you want to be called on a search long press,
start by looking through the documentation for intents related to that and
setting up your manifest to match.

-------------------------------------------------------------------------------------------------
TreKing < http://sites.google.com/site/rezmobileapps/treking> ; - Chicago
transit tracking app for Android-powered devices

-- 


Sponsored Links


Re: Global search app

by Jake Basile » Wed, 15 Dec 2010 06:36:03 GMT


 You might try android.intent.action.VOICE_COMMAND, but I don't know if 
that's the right intent for what you want.

-- 



Re: Global search app

by Jake Basile » Wed, 15 Dec 2010 06:49:05 GMT


 I also just saw that android.intent.action.SEARCH_LONG_PRESS exists, so 
maybe that's one you can use too.

-- 



Re: Global search app

by neuromit » Wed, 15 Dec 2010 08:33:34 GMT


 Thanks a million




-- 



Re: Global search app

by neuromit » Wed, 15 Dec 2010 10:49:30 GMT


 ok I added the following lines to the <intent filter> of my manifest
file:
<action android:name="android.intent.action.SEARCH_LONG_PRESS" />
<action android:name="android.intent.action.VOICE_COMMAND"/>

and then I added code to deal with the intents to the appropriate
class.

However when I run test the code I'm never prompted to pick a default
application. Long pressing the search button brings up the voice
search dialog box.

Is there something else I need to specify to say that my application
should be launched on a search button long press?




-- 



Re: Global search app

by Jake Basile » Wed, 15 Dec 2010 11:12:28 GMT


 You may have to go into Settings>Apps>Manage Apps find Voice Search, and 
then clear defaults.

I'm not really sure though. You may also want to try 
android.speech.action.RECOGNIZE_SPEECH< http://developer.android.com/reference/android/speech/RecognizerIntent.html #ACTION_RECOGNIZE_SPEECH>

-- 



Re: Global search app

by Jake Basile » Wed, 15 Dec 2010 11:14:40 GMT


 Also, you may need to add <category 
android:name="android.intent.category.DEFAULT"/>

-- 



Re: Global search app

by neuromit » Wed, 15 Dec 2010 11:23:08 GMT


 thanks for your replies... but I think I need to do something more.

My SMS client (ChompSMS) can be bound to the search button long press
and it doesn't start any sort of voice recognition activity.

When I cleared the default application and long pressed the search
button the dialog appeared offering me which activity to launch it
didn't list mine.

hmm... this is getting a bit frustrating.





-- 



Re: Global search app

by neuromit » Wed, 15 Dec 2010 11:50:30 GMT


 Ahh.. I missed your post where you said to add:
<category android:name="android.intent.category.DEFAULT" />

this indeed fixes the problem!






-- 



Re: Global search app

by Jake Basile » Wed, 15 Dec 2010 12:15:50 GMT


 Cool, glad I could help.

-- 



Re: Global search app

by Bob Kerns » Wed, 15 Dec 2010 14:14:18 GMT


 OK, but now that you've got all that figured out -- are you sure this
is really what you want to be doing? As opposed to extending the
existing search capabilities with a searchable content provider?

 http://developer.android.com/intl/de/guide/topics/search/adding-custom-suggestions.html #QSB

As a user, I would never, in a million years, consider giving up the
Android-provided global search capabilities.  Search is really, really
important.  So unless you're providing a superset of the functionality
which would be a *lot* of work!), I would think that extending the
existing capabilities rather than writing your own app is the way to
go.

If you're thinking of the search key as a shortcut to your
application, I think that's a really, really bad idea.

If your goal is to provide a better search app than the default one --
I hope you know what you're getting into, and wish you the best of
luck! And look forward to trying it out.




-- 



Re: Re: Global search app

by TreKing » Wed, 15 Dec 2010 23:36:54 GMT


 






In all fairness, it sounds like the OP is trying to override the LONG PRESS
of the search key, not the regular press. By default a quick press starts a
search, while a long press starts *voice* search. The average user probably
doesn't even know this exists. (I showed a friend with a new EVO this trick
and blew her mind).

-------------------------------------------------------------------------------------------------
TreKing < http://sites.google.com/site/rezmobileapps/treking> ; - Chicago
transit tracking app for Android-powered devices

-- 



Re: Global search app

by neuromit » Thu, 16 Dec 2010 06:02:03 GMT


 Treking, this is exactly what I'm trying to do.







-- 



Re: Global search app

by Bob Kerns » Thu, 16 Dec 2010 12:04:01 GMT


 Ah. Well, I still think that's a bad idea, unless you're providing an
enhanced superset. While the "average user" might not know it exists
-- they'd probably really like to know it existed.





-- 



Other Threads

1. Live video streaming from Android

Is it possible to stream live video from android to a server?

If yes, can somebody give me some hints in how to do it?

Please reply.

Thanks

--

2. Webserver+php

Guys, ada nggak webserver+php jalan dalam lingkungan android ?

Thnx. 
aom-dps-javelin

-- 
"

3. ExpandableListView for only mp3 albums. Tips requested

4. Hybrid Eclipse/Command line environment now stuck wanting debugger

5. Debugging a separate thread.

6. Click event on Edit-Text's Right Drawable.

7. Layout related