“Failed to find provider info ” when Adding Recent Query Suggestions

  • Replies:2
  • OpenNot stickiedUnanswered

Jan 16, 2011 5:39:21 PM via Website

Hi, I am trying to implement recent Query Suggestions into my app, but got stuck in a “Failed to find provider info ” error
please give some help

code as below:

-------------------------------------------------------------------------------------------
//searchable.xml

<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:searchSuggestAuthority = "testing.advancedsearch.mysuggestionprovider"
android:searchSuggestSelection=" ?"
>
</searchable>

-------------------------------------------------------------------------------------------
// content provider class

package testing.advancedsearch;

import android.content.SearchRecentSuggestionsProvider;

public class MySuggestionProvider extends SearchRecentSuggestionsProvider {
public final static String AUTHORITY = "testing.advancedsearch.mysuggestionprovider";
public final static int MODE = DATABASE_MODE_QUERIES;

public MySuggestionProvider() {
setupSuggestions(AUTHORITY, MODE);
}
}

-------------------------------------------------------------------------------------------

// manifest.xml

<provider android:name=".MySuggestionProvider"
android:authorities="testing.advancedsearch.mysuggestionprovider" />

-------------------------------------------------------------------------------------------

— modified on Jan 19, 2011 4:14:54 PM

Jan 18, 2011 10:21:51 AM via Website

Have you seen this page on how to use the search provider: http://developer.android.com/reference/android/content/SearchRecentSuggestionsProvider.html

I think you need to replace <provider android:name=".MySuggestionProvider" in the manifest file, with the class name of the activity you want to search. Unless "MySuggestionProvider" is the class you want to search?

Also, shouldn't the SuggestAuthority in the the serachable.xml and the manifest match?

— modified on Jan 18, 2011 10:24:06 AM

Jan 20, 2011 8:40:52 AM via Website

There's also a guide here: http://developer.android.com/guide/topics/search/adding-recent-query-suggestions.html

One thing I noticed in the guide, in the manifest file when they declare the content provider, they use a period at the beginning: <provider android:name=".MySuggestionProvider" Have you tried putting the whole class name with the package before the period? Like so,

<provider android:name="testing.advancedsearch.MySuggestionProvider"

Some examples I've seen they use Super(); before setupSuggestions(AUTHORITY, MODE); Like so:

public MySuggestionProvider() {
super();
setupSuggestions(AUTHORITY, MODE);
}

Though I don't know if this will make any difference.