English | 中文
HMS Search Kit sample code encapsulates APIs of the HUAWEI Search Kit. It provides a sample programs for your reference or usage.
Before using HMS Search Kit sample code, check whether the BD_SearchKitCodeLab environment has been installed. Decompress the HMS Search Kit sample code package.
Refresh the project and ensure that is successfully.
searchkit 5.0.4.305 or a later version is recommended. The Android SDK is available only on a mobile device running Android API-Level 24 (Android 7.0 Marshmallow) or higher. Android studio.
- Register and sign in to HUAWEI Developers.
- Create a project and then create an app in the project, enter the project package name.
- Go to Project Settings > Manage APIs, find the Search Kit API, and enable it.
- Go to Project Settings > General information, click Set next to Data storage location under Project information, and select a data storage location in the displayed dialog box.
- Download the agconnect-services.json file and place it to the app's root directory of the project.
- Add the Maven repository address maven {url 'https://developer.huawei.com/repo/'} and plug-in class path 'com.huawei.agconnect:agcp:1.3.1.300' to the project-level build.gradle file.
- Add apply plugin: 'com.huawei.agconnect' to the last line of the app-level build.gradle file.
- Configure the dependency com.huawei.hms:searchkit:5.0.4.305 in the app-level buildle.gradle file.
- Synchronize the project.
-
Web search. Code location: searchindex/SearchActivity.java
-
Image search. Code location: searchindex/SearchActivity.java
-
Video search. Code location: searchindex/SearchActivity.java
-
News search. Code location: searchindex/SearchActivity.java
-
Custom search. Code location: searchindex/SearchActivity.java
-
Suggest. Code location: searchindex/SearchActivity.java
-
Spell check. Code location: searchindex/SearchActivity.java
web search
image search
video search
news search
custom search
HMS Search Kit sample is licensed under the Apache License, version 2.0.