In my searchable.xml, I have:
android:voiceSearchMode="showVoiceSearchButton|launchRecognizer"
I get the search string returned SearchManager like so:
if (Intent.ACTION_SEARCH.equals(action)) {
searchString = intent.getStringExtra(SearchManager.QUERY);
}
Is there any way to get from the intent whether the search string came from the keyboard, or as a result of voice search and the speech Recognizer?
I know I can put entities like:
<actionkey android:keycode="KEYCODE_SEARCH" android:queryActionMsg="search"/> <actionkey android:keycode="KEYCODE_ENTER" android:queryActionMsg="enter"/>
in my searchable.xml file, and then use intent.getIntExtra(SearchManager.ACTION_KEY,-999) to see if the search started because the user hit the Enter key on the keyboard, or the hardware Search button, but I don't see how to detect that the search was started from the "microphone" icon button, or the "search" icon button in the search bar.
(In the case of a voice search, I need to echo the text back to the user while I do a further web lookup. For a text search, echoing what the user just typed is redundant.)
How can I tell the difference?