Skip to content

HMS search kit demo provides an example of integrating HUAWEI Search Kit with an app.This topic uses the search home page and search content details page as examples to describe how to use Search Kit functions and display data returned by interfaces.

License

Notifications You must be signed in to change notification settings

HMS-Core/hms-search-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HMS Search Kit Demo

English | 中文

Table of Contents

Introduction

HMS Search Kit sample code encapsulates APIs of the HUAWEI Search Kit. It provides a sample programs for your reference or usage.

Installation

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.

Supported Environments

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.

Configuration

  1. Register and sign in to HUAWEI Developers.
  2. Create a project and then create an app in the project, enter the project package name.
  3. Go to Project Settings > Manage APIs, find the Search Kit API, and enable it.
  4. 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.
  5. Download the agconnect-services.json file and place it to the app's root directory of the project.
  6. 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.
  7. Add apply plugin: 'com.huawei.agconnect' to the last line of the app-level build.gradle file.
  8. Configure the dependency com.huawei.hms:searchkit:5.0.4.305 in the app-level buildle.gradle file.
  9. Synchronize the project.

Sample Code

  1. Web search. Code location: searchindex/SearchActivity.java

  2. Image search. Code location: searchindex/SearchActivity.java

  3. Video search. Code location: searchindex/SearchActivity.java

  4. News search. Code location: searchindex/SearchActivity.java

  5. Custom search. Code location: searchindex/SearchActivity.java

  6. Suggest. Code location: searchindex/SearchActivity.java

  7. Spell check. Code location: searchindex/SearchActivity.java

Result

web search

image search

video search

news search

custom search

License

HMS Search Kit sample is licensed under the Apache License, version 2.0.

About

HMS search kit demo provides an example of integrating HUAWEI Search Kit with an app.This topic uses the search home page and search content details page as examples to describe how to use Search Kit functions and display data returned by interfaces.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages