• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2008 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.example.android.apis.app;
18 
19 import android.content.SearchRecentSuggestionsProvider;
20 
21 /**
22  * To create a search suggestions provider using the built-in recent queries mode,
23  * simply extend SearchRecentSuggestionsProvider as shown here, and configure with
24  * a unique authority and the mode you with to use.  For more information, see
25  * {@link android.content.SearchRecentSuggestionsProvider}.
26  */
27 public class SearchSuggestionSampleProvider extends SearchRecentSuggestionsProvider {
28 
29     /**
30      * This is the provider authority identifier.  The same string must appear in your
31      * Manifest file, and any time you instantiate a
32      * {@link android.provider.SearchRecentSuggestions} helper class.
33      */
34     final static String AUTHORITY = "com.example.android.apis.SuggestionProvider";
35     /**
36      * These flags determine the operating mode of the suggestions provider.  This value should
37      * not change from run to run, because when it does change, your suggestions database may
38      * be wiped.
39      */
40     final static int MODE = DATABASE_MODE_QUERIES;
41 
42     /**
43      * The main job of the constructor is to call {@link #setupSuggestions(String, int)} with the
44      * appropriate configuration values.
45      */
SearchSuggestionSampleProvider()46     public SearchSuggestionSampleProvider() {
47         super();
48         setupSuggestions(AUTHORITY, MODE);
49     }
50 }
51