Baidu map mobile edition API integrated search services include: location search, peripheral search, range search, bus search, driving and walking search. By initializing the mksearch class, register the listening object mksearchlistener for the search results, implement Asynchronous search service. First, customize mysearchlistener to implement the mksearchlistener interface. Different callback methods are used to obtain the search results:
public class MySearchListener implements MKSearchListener { @Override public void onGetAddrResult(MKAddrInfo result, int iError) { } @Override public void onGetDrivingRouteResult(MKDrivingRouteResult result, int iError) { } @Override public void onGetPoiResult(MKPoiResult result, int type, int iError) { } @Override public void onGetTransitRouteResult(MKTransitRouteResult result, int iError) { } @Override public void onGetWalkingRouteResult(MKWalkingRouteResult result, int iError) { }}
Then initialize the mksearch class:
Mksearch = new mksearch (); mksearch. INIT (mapmanager, new mysearchlistener (); // note that only one mksearchlistener is supported. The last setting prevails.
Knowledge Used by the Search Service: mksearch
It is used for location search, peripheral search, range search, bus search, driving car search, and walking search.
Field Abstract
| Type |
Name |
| Static int |
Ebus_no_subway
-
-
Public transport retrieval policy constant: Excluding Subway
|
| Static int |
Ebus_time_first
-
-
Public transport retrieval policy constant: time first
|
| Static int |
Ebus_transfer_first
-
-
Public transport retrieval policy constant: minimum transfer
|
| Static int |
Ebus_assist_first
-
-
Constant of public transport retrieval policy: Minimum walking distance
|
| Static int |
Ecar_dis_first
-
-
Constant driving search policy: Shortest Distance
|
| Static int |
Ecar_fee_first
-
-
Constant driving and driving search policy: relatively low cost
|
| Static int |
Ecar_time_first
-
-
Constant driver/driver search policy: time first
|
| Static int |
Type_area_poi_list
-
-
Poi list for range search and peripheral search
|
| Static int |
Type_city_list
-
-
City list
|
| Static int |
Type_poi_list
-
-
Search poi list in the city
|
| Static int |
Type_area_multi_poi_list
-
-
Multi-keyword search list in a city
|
Constructor Summary
| Method |
Mksearch ()
-
-
Constructor
|
Method Summary
| Return type |
Method |
| Int |
Drivingsearch (Java. Lang. String startcity, mkplannode start,
Java. Lang. String endcity, mkplannode end)
-
-
Driving route search.
|
| Static int |
Getpoipagecapacity ()
-
-
Return capacity per page
|
| Int |
Gotopoipage (INT num)
-
-
Obtain the poi result of the specified page.
|
| Boolean |
Init (bmapmanager bmapman, mksearchlistener listener)
-
-
Initial tutorial
|
| Int |
Poisearchinbounds (Java. Lang. String
Key, geopoint ptlb, geopoint ptrt)
-
-
Initiate a range search based on the range and keyword.
|
| Int |
Poimultisearchinbounds (Java. Lang. String
Key, geopoint ptlb, geopoint ptrt)
-
-
Initiate a range search based on the range and multiple search terms.
|
| Int |
Poisearchincity (Java. Lang. String city,
Java. Lang. String key)
-
-
City poi search.
|
| Int |
Poisearchnearby (Java. Lang. String key, geopoint PT,
Int radius)
-
-
Initiate peripheral search based on the center point, radius, and search term.
|
| Int |
Poimultisearchnearby (Java. Lang. String
Key, geopoint PT, int radius)
-
-
Initiate peripheral search based on the center point, radius, and multiple search terms.
|
| Int |
Reversegeocode (geopoint pt)
-
-
Asynchronous function for obtaining address information based on geographic coordinate points, and ongetaddrresult method notification of returned results in mksearchlistener
|
| Int |
Geocode (Java. Lang. String straddr, java. Lang. String
City)
-
-
Asynchronous function for obtaining address information based on address name, which returns the ongetaddrresult method notification of the result in mksearchlistener.
|
| Int |
Setdrivingpolicy (INT Policy)
-
-
Set the driving route planning policy.
|
| Static void |
Setpoipagecapacity (INT num)
-
-
Set the size of each page.
|
| Int |
Settransitpolicy (INT Policy)
-
-
Set route planning policies.
|
| Int |
Transitsearch (Java. Lang. String city, mkplannode start, mkplannode end)
-
-
Search for bus routes.
|
| Int |
Walkingsearch (Java. Lang. String startcity, mkplannode start,
Java. Lang. String endcity, mkplannode end)
-
-
Search for walking routes.
|