As a matter of first importance, you need to coordinate Huawei Mobile Services with your application. Then, you can utilize this article as bit by bit direct.
Establishment
First of all, how about we introduce the library.
npm I @hmscore/respond local hms-site
After the establishment is finished, we can import the library.
Before we can utilize the highlights of the HMS site unit, we need to introduce it. To introduce the help, you will require an API key. When you incorporate your application with HMS, AppGallery Connect will consequently give an API key to you. You can discover your API key on AppGallery Connect > YourApp > Project Settings > General data > App data.
Since we have our programming interface key, we should call introduce administration work.
If your API key is right in hms site kit, you will see “Administration is instated effectively” on your reassure.
Utilization
Presently we can begin utilizing HMS React Native Site Kit. How about we start with a watchword search.
Keyword(Text) Search
HMS Site pack watchword search includes the usefulness that profits place list dependent on your client’s Keywordinput. Likewise, you can determine an area in which the item will be biased. You can determine search sweep, nation, language, and page size. You can set the POI (Point of Interest) for the Keyword search where results can be separated dependent on POI. The client can look through Bakery, School, ATM, and so on.
We should make a TextSearchRequest object, which is utilized as the solicitation body for Keyword search. Related boundaries are as per the following, among which query is mandatory, and others are discretionary:
- ·query: search keyword.
- ·location: longitude and scope to which indexed lists should be one-sided.
- ·radius: search range, in meters. The worth reaches from 1 to 50000. The default esteem is 50000.
- ·poiType: POI type. The worth reach is equivalent to that of LocationType.
- ·countryCode: code of the country where spots are looked at, which conforms to the ISO 3166–1 alpha-2 norm.
- ·language: language in which indexed lists are shown. For insights concerning the worth reach, if it’s not too much trouble, allude to language codes in Language Mapping. If this boundary isn’t passed, the language of the question field is utilized in need. If the field language is inaccessible, the neighborhood language will be utilized.
- ·pageSize: number of records on each page. The worth reaches from 1 to 20. The default esteem is 20.
- ·pageIndex: current page number. The worth reaches from 1 to 60. The default esteem is 1.
After that, we can call text search work and send our TextSearchRequest object as a boundary like this.
Conclusion
Presently you realize how to utilize the HMS Site Kit module for React Native. With that information, you can carry out stunning functionalities to your application that HMS Site Kit offers. You can communicate with your clients in more and various manners and draw in considerably more clients. For example, you can carry out Keywordlook for places, search close by places, get places subtleties, and give search ideas to your client.