search

satya - Saturday, October 10, 2009 11:01:59 AM

start with 1.6 feature list

start with 1.6 feature list

satya - Saturday, October 10, 2009 11:02:24 AM

Here is the API ref for SearchManager

Here is the API ref for SearchManager

satya - Wednesday, October 14, 2009 10:17:10 AM

How can I invoke android global search when my activity is in focus

How can I invoke android global search when my activity is in focus

Search for: How can I invoke android global search when my activity is in focus

satya - Wednesday, October 14, 2009 1:23:52 PM

what is an android application defined search

what is an android application defined search

Search for: what is an android application defined search

satya - Wednesday, October 14, 2009 3:21:06 PM

Android what is single top singletop launchmode

Android what is single top singletop launchmode

Search for: Android what is single top singletop launchmode

satya - Wednesday, October 14, 2009 3:50:26 PM

How can I search across multiple android applications?

How can I search across multiple android applications?

Search for: How can I search across multiple android applications?

satya - Wednesday, October 14, 2009 6:26:25 PM

FLAG_ACTIVITY_SINGLE_TOP

FLAG_ACTIVITY_SINGLE_TOP

Search for: FLAG_ACTIVITY_SINGLE_TOP

satya - Wednesday, October 14, 2009 6:59:40 PM

documentation on newintent

documentation on newintent

satya - Friday, October 16, 2009 2:27:52 PM

DEFAULT_KEYS_SEARCH_GLOBAL

Use with setDefaultKeyMode(int) to specify that unhandled keystrokes will start a global search (typically web search, but some platforms may define alternate methods for global search)

satya - Friday, October 16, 2009 2:28:20 PM

DEFAULT_KEYS_SEARCH_LOCAL

Use with setDefaultKeyMode(int) to specify that unhandled keystrokes will start an application-defined search. (If the application or activity does not actually define a search, the the keys will be ignored.)

satya - Friday, October 16, 2009 2:42:32 PM

Can android search results be from multiple applications?

Can android search results be from multiple applications?

Search for: Can android search results be from multiple applications?

satya - Friday, October 16, 2009 2:43:44 PM

all about android quick search box

all about android quick search box

Search for: all about android quick search box

satya - Friday, October 16, 2009 2:56:01 PM

implementation of searchable dictionary

implementation of searchable dictionary

satya - Friday, October 16, 2009 3:14:10 PM

The idea of a universal search

satya - Friday, October 16, 2009 3:15:04 PM

The above image is taken from google blogspot. See the blog here

The above image is taken from google blogspot. See the blog here

satya - Friday, October 16, 2009 3:15:50 PM

A user has to choose your app to be part of the suggestion providers

satya - Friday, October 16, 2009 3:17:31 PM

New things in 1.6


<searchable xmlns:android="http://schemas.android.com/apk/res/android"
       android:label="@string/search_label"
       android:searchSettingsDescription="@string/settings_description"
       android:includeInGlobalSearch="true"
       android:searchSuggestAuthority="dictionary"
       android:searchSuggestIntentAction="android.intent.action.VIEW">
</searchable>

satya - Friday, October 16, 2009 3:19:01 PM

setting includeInGlobalSearch to true enables...

enables your app to participate in suggestions.

satya - Friday, October 16, 2009 3:19:36 PM

The description is useful to the user while he/she is chosing your app to include...

The description is useful to the user while he/she is chosing your app to include...

satya - Friday, October 16, 2009 3:27:42 PM

See if this works

satya - Monday, October 19, 2009 1:31:37 PM

What can be provided as a set of search suggestions


Actual searchable results (e.g. names in the address book) 
Recently entered queries 
Recently viewed data or results 
Contextually appropriate queries or results 
Summaries of possible results

satya - Monday, October 19, 2009 1:32:28 PM

Zero query suggestions

when no query text has been typed yet - an application may also opt to provide zero-query suggestions. These would typically be drawn from the same data source, but because no partial query text is available, they should be weighted based on other factors - for example, most recent queries or most recent results.

satya - Tuesday, October 20, 2009 1:17:44 PM

SearchRecentSuggestions API

SearchRecentSuggestions API

satya - Tuesday, October 20, 2009 1:21:39 PM

Constructing one of these


SearchSuggestions suggestions = new SearchSuggestions(this, 
          MySuggestionsProvider.AUTHORITY, MySuggestionsProvider.MODE);
suggestions.saveRecentQuery(queryString, null);

satya - Tuesday, October 20, 2009 1:22:03 PM

Important method


public void saveRecentQuery (String queryString, String line2)

satya - Tuesday, October 20, 2009 1:22:45 PM

queryString

The string as typed by the user. This string will be displayed as the suggestion, and if the user clicks on the suggestion, this string will be sent to your searchable activity (as a new search query).

satya - Tuesday, October 20, 2009 1:23:08 PM

line2

If you have configured your recent suggestions provider with DATABASE_MODE_2LINES, you can pass a second line of text here. It will be shown in a smaller font, below the primary suggestion. When typing, matches in either line of text will be displayed in the list. If you did not configure two-line mode, or if a given suggestion does not have any additional text to display, you can pass null here.

satya - Tuesday, October 20, 2009 1:23:55 PM

DATABASE_MODE_2LINES

DATABASE_MODE_2LINES

Search for: DATABASE_MODE_2LINES

This mode bit configures the database to include a 2nd annotation line with each entry

satya - Tuesday, October 20, 2009 1:24:40 PM

DATABASE_MODE_QUERIES

DATABASE_MODE_QUERIES

Search for: DATABASE_MODE_QUERIES

This mode bit configures the database to record recent queries

satya - Tuesday, October 20, 2009 1:25:26 PM

API reference for these modes in searchrecentsuggestionsprovider

API reference for these modes in searchrecentsuggestionsprovider

satya - Tuesday, October 20, 2009 2:15:37 PM

Here is an example of specifying the suggestion provider


<searchable xmlns:android="http://schemas.android.com/apk/res/android"
    android:label="@string/search_label"
    android:hint="@string/search_hint" 
    android:searchMode="showSearchLabelAsBadge"
    
android:searchSuggestAuthority="com.ai.android.search.TestSuggestionProvider"
	android:searchSuggestPath="read-the-caveat-below"
    android:searchSuggestSelection=" ? "
/>

satya - Tuesday, October 20, 2009 2:16:11 PM

what is the funny '?'

If you define the attribute value android:searchSuggestSelection and include a string, this string will be passed as the selection parameter to your Content Provider's query function. You must define a single selection argument, using the '?' character. The user's query text will be passed to you as the first element of the selection arguments array

To understand this you have to see the signature of the "ContentProvider.query()" method which takes among other things a uri, a single string argument called "selection" (which should be called where clause), an array of strings called "selectionarguments". The value of the searchSuggestSelection will become the "selection" argument. The search string that user has typed will be passed as the first element of the string argument array. It is as simple as that. It is up to the content provider's query method to retrieve the first element of the string argument array and do what is necessary.

note that if this value is not specified then Android assumes that the search query needs to be passed at the end of the uri.

satya - Tuesday, October 20, 2009 2:17:07 PM

How is your suggestion provider invoked?


content:// your.suggest.authority 
/ your.suggest.path 
/ SearchManager.SUGGEST_URI_PATH_QUERY

The value "your.suggest.path" is taken from the value of the searchSuggestPath. It is typically unnecessary as the content provider hones in on only one uri signature. The default suggestion provider that you normally inherit from doesn't use this path. So dont add this line if you are using that one.

satya - Tuesday, October 20, 2009 2:17:51 PM

If you don't specify the query string

If you do not define the attribute value android:searchSuggestSelection, then the Search Manager will append another "/" followed by the user's query to the query Uri. The query will be encoding using Uri encoding rules - don't forget to decode it. (See getPathSegments() and getLastPathSegment() for helpful utilities you can use here.)

satya - Tuesday, October 20, 2009 10:23:21 PM

Enabling the suggestion provider to the global box


<searchable xmlns:android="http://schemas.android.com/apk/res/android"
    android:label="@string/search_label"
    android:hint="@string/search_hint" 
    android:searchMode="showSearchLabelAsBadge"
    android:includeInGlobalSearch="true"
    
    android:searchSuggestAuthority="com.ai.android.search.TestSuggestionProvider"
    android:searchSuggestSelection=" ? "
/>

satya - Wednesday, October 21, 2009 9:44:34 AM

type-to-search bug problem global

type-to-search bug problem global

Search Google for: type-to-search bug problem global

Search Android Developers Group for: type-to-search bug problem global

Search Android Beginers Group for: type-to-search bug problem global

Search Google Code for: type-to-search bug problem global

Search Android Issues Database for: type-to-search bug problem global

satya - Wednesday, October 21, 2009 9:45:00 AM

quick search box complete action using

quick search box complete action using

Search Google for: quick search box complete action using

Search Android Developers Group for: quick search box complete action using

Search Android Beginers Group for: quick search box complete action using

Search Google Code for: quick search box complete action using

Search Android Issues Database for: quick search box complete action using

satya - Wednesday, October 21, 2009 9:46:10 AM

type to search bug problem global

type to search bug problem global

Search Google for: type to search bug problem global

Search Android Developers Group for: type to search bug problem global

Search Android Beginers Group for: type to search bug problem global

Search Google Code for: type to search bug problem global

Search Android Issues Database for: type to search bug problem global

satya - Friday, October 23, 2009 9:59:20 AM

searchable dictionary java files

searchable dictionary java files

satya - Friday, October 23, 2009 10:04:45 AM

resource files

manifest file

searchable.xml

strings.xml

layout-main.xml

layout-word.xml

satya - Friday, October 23, 2009 11:13:44 AM

Possible search metadata settings

Note: Replace "." with "searchSuggest"


searchSuggestAuthority
.Path
.Selection
.IntentAction
.IntentData
includeInGloabalSearch
searchSettingsDescription
queryAfterZeroResults
.Threshold

satya - Friday, October 23, 2009 11:16:36 AM

non suggestion related


label
icon
searchMode
  showSearchLabelAsBadge
  showSearchIconAsBadge
  queryRewriteFromData
  queryRewriteFromText
inputType
imeOptions

satya - Friday, October 23, 2009 11:45:15 AM

The idea of shortcuts

1. Android replicates a suggestion line by default.

2. If you don't want that to happen then you need to include a column


suggest_column_shortcut_id 

and set it to


suggest_never_make_shortcut.

3. If this column contains a value then a query is sent out with the following uri


suggest_uri_path_shortcut

possible followed by the id of the shortcut or suggestion

4. You can indicate a long time opration by including a column


suggest_column_spinner_while_refreshing

satya - Friday, October 23, 2009 11:51:35 AM

List of columns in the query result


format //ignored
text_1
text_2
icon_1
icon_2
intent_action
intent_data
intent_data_id //the last part of the uri
intent_extra_data //has a key of etra_data_key
query //query string to be used
shortcut_id
spinner_while_refreshing
...action key columns

satya - Friday, October 23, 2009 11:55:06 AM

Query Rewrite

1. will be taken from query column if available

2. if queryRewriteFromData is used, it will be taken from the intent data field

3. if queryReqriteFromText is used, text_1 will be used

satya - Friday, October 23, 2009 2:38:29 PM

Here is an example uri fired off by Android for a custome suggestion provider


content://com.ai.android.search.suggesturlprovider
/search_suggest_query
?limit=58

satya - Friday, October 23, 2009 4:18:07 PM

Intetn that gets launched when a custom suggestion is picked


launching Intent { 
act=android.intent.action.VIEW 
dat=http://www.google.com 
flg=0x10000000 
cmp=com.ai.android.search.custom/.SearchActivity (has extras) 
}

satya - Friday, October 23, 2009 4:18:46 PM

Notice how the activity component is hard coded...

which makes me suspect that the intent actions are always targeted for this activity.

satya - Friday, October 23, 2009 4:24:07 PM

SUGGEST_COLUMN_INTENT_ACTION

SUGGEST_COLUMN_INTENT_ACTION

Search Google for: SUGGEST_COLUMN_INTENT_ACTION

Search Android Developers Group for: SUGGEST_COLUMN_INTENT_ACTION

Search Android Beginers Group for: SUGGEST_COLUMN_INTENT_ACTION

Search Google Code for: SUGGEST_COLUMN_INTENT_ACTION

Search Android Issues Database for: SUGGEST_COLUMN_INTENT_ACTION

satya - Saturday, October 24, 2009 10:12:01 AM

INSTALL_FAILED_CONFLICTING_PROVIDER

INSTALL_FAILED_CONFLICTING_PROVIDER

Search Google for: INSTALL_FAILED_CONFLICTING_PROVIDER

Search Android Developers Group for: INSTALL_FAILED_CONFLICTING_PROVIDER

Search Android Beginers Group for: INSTALL_FAILED_CONFLICTING_PROVIDER

Search Google Code for: INSTALL_FAILED_CONFLICTING_PROVIDER

Search Android Issues Database for: INSTALL_FAILED_CONFLICTING_PROVIDER

satya - Saturday, October 24, 2009 10:29:33 AM

See this thread for an answer

See this thread for an answer

satya - Saturday, October 24, 2009 10:30:03 AM

Problem seem to be duplicate provider names as in


<provider android:name=".search.SearchSuggestionSampleProvider" 
an.droid:authorities="com.example.android.apis.SuggestionProvider" />

satya - Monday, October 26, 2009 8:16:37 AM

A Sample action key element in the manifest file


<actionkey
     android:keycode="KEYCODE_CALL"
     android:queryActionMsg="call"
     android:suggestActionMsg="call"
     android:suggestActionMsgColumn="call_column" />

satya - Monday, October 26, 2009 8:16:53 AM

queryActionMsg

queryActionMsg

Search Google for: queryActionMsg

Search Android Developers Group for: queryActionMsg

Search Android Beginers Group for: queryActionMsg

Search Google Code for: queryActionMsg

Search Android Issues Database for: queryActionMsg

satya - Monday, October 26, 2009 8:24:26 AM

Available key codes in KeyEvent

Available key codes in KeyEvent

satya - Monday, October 26, 2009 8:26:52 AM

some relevent key codes


action_down
action_up
keycode_back
keycode_call
keycode_camera
keycode_clear
kecode_endcall
keycode_home
keycode_menu
keycode_mute
keycode_power
keycode_search
keycode_volume_up
keycode_volume_down

satya - Monday, October 26, 2009 8:27:24 AM

Not all these keys are overridable this way

Not all these keys are overridable this way

satya - Monday, October 26, 2009 8:51:55 AM

Significance of each attribute

keycode: This is the key code as defined in the KeyEvent API class that should be used to invoke the search activity. There are two times where this key identified by the keycode can be pressed. The first one is when user enters query text in QSB but hasn't navigated to any suggestions. Typically user, with out an action key implementation, would have pressed the search icon of the QSB. With an Action Key specified in the metadata of the search, Android allows the user to click the action key instead of the QSB search icon. The second one is the user navigates to a specific suggestion and then clicks the action key. In both cases the search activity is invoked with an action of ACTION_SEARCH. To know that this action is invoked through an action key look for an extra string called SearchManager.ACTION_KEY. If you see a value here you know that you are being called in response to an action key press.

queryActionMsg: Any text you enter in this element is passed to the search activity invoking intent as an extra string called SearchManager.ACTION_MSG. If you retrieve this message from the intent and it is the same as what you have specified in the metadata then you know that you are being called directly from the QSB (as opposed through a suggestion) and clicking on the action key. With out this test you will not know if the ACTION_SEARCh is called due to an action key click on the suggestion directly.

suggestActionMsg: Any text you enter in this element is passed to the search activity invoking intent as an extra string called SearchManager.ACTION_MSG. So if you notice the extra keys for this and the queryActionMsg are the same. If you give the same value for both of these fields such as say "call", then you will not know in what way the user has invoked the action key. Many cases this is irrelevant in which case you can just give the same value for both. But if you have a need to distinguish one from the other then you will need specify value that is different from the queryActionMsg.

suggestActionMsgColumn: The values queryActionMsg and suggestActionMsg apply globally to this search activity and the suggestion provider. There isn't way to alter the action based on the suggestion. If you would like to do that then you will need to tell the metadata that there is an extra column in the suggestion cursor. This will allow Android to pick up the text from that extra column and send the activity as part of the invoking ACTION_SEARCH intent. Interestingly the value of this additional column is sent through the same extra key in the intent namely: SearchManager.ACTION_MSG.

satya - Monday, November 02, 2009 7:05:19 PM

Here is how you can override the onSearchRequested


	public boolean onSearchRequested() 
	{
		Bundle b = new Bundle();
		b.putString("string_key", "hello");
		b.putLong("long_key", 2);
		b.putFloat("float_key", 2.2f);
		
		String queryText = null;
		boolean dontPreSelectText = false;
		boolean dontAlwaysInvokeGlobalSearch = false;
		
		this.startSearch(queryText,
				dontPreSelectText,
				b,
				dontAlwaysInvokeGlobalSearch);
		return true;
	}

satya - Monday, November 02, 2009 7:14:11 PM

Here is how you retrieve


Bundle applicationData = 
   queryIntent.getBundleExtra(SearchManager.APP_DATA);
if (applicationData != null)
{
	String s = applicationData.getString("string_key");
	long   l = applicationData.getLong("long_key");
	float  f = applicationData.getFloat("float_key");
}

satya - Monday, November 02, 2009 7:15:47 PM

Various key extras


QUERY
USER_QUERY
APP_DATA
ACTION_KEY
ACTION_MSG
EXTRA_DATA_KEY

satya - Monday, November 02, 2009 7:17:39 PM

Uris and Mime types


SHORTCUT_MIME_TYPE
SUGGEST_MIME_TYPE

SUGGEST_URI_PATH_QUERY
SUGGEST_URI_PATH_SHORTCUT

SUGGEST_NEVER_MAKE_SHORTCUT

satya - Monday, November 02, 2009 7:18:24 PM

actions


ACTION_SEARCH
ACTION_VIEW

satya - Fri Nov 30 2012 09:56:46 GMT-0500 (Eastern Standard Time)

android.app.default_searchable

android.app.default_searchable

Search for: android.app.default_searchable

satya - Fri Nov 30 2012 09:59:10 GMT-0500 (Eastern Standard Time)

android.app.default_searchable value of star *

android.app.default_searchable value of star *

Search for: android.app.default_searchable value of star *

satya - Fri Nov 30 2012 10:12:15 GMT-0500 (Eastern Standard Time)

MD_SEARCHABLE_SYSTEM_SEARCH

MD_SEARCHABLE_SYSTEM_SEARCH

Search for: MD_SEARCHABLE_SYSTEM_SEARCH

Looks like this value is deprecated in Searchables.java

satya - Fri Nov 30 2012 10:13:21 GMT-0500 (Eastern Standard Time)

Invoking global search by default for an android application

Invoking global search by default for an android application

Search for: Invoking global search by default for an android application