Charging Station Search
The charging station search function can obtain the details of the POI information of the charging pile. According to the search method, it can be divided into keyword search, circular search, rectangular search, and search along the road.
Keyword Search
Keyword search is a search conducted with keyword conditions set. The sample code is as follows:
EVSearch mEvSearch = new EVSearch(); //Setting parameters mEvSearch.setQuery(EVSearch.Query.newQuery("Tesla")); mEvSearch.setListener(new EVSearch.Listener() { @Override public void onSuccess(final POISearchResult result) { //Search succeeded } @Override public void onFail(APIStatus status) { //Search failed } }); //Initiate search mEvSearch.search();
EVSearch.Query Description:
1. The instance can only be obtained by the newQuery (String keyword) method in EVSearch.Query.
2. Parameter keyword: Search for keywords.
Note: The result return interface is an asynchronous thread interface. If the Android project needs to operate the control in the return, it must switch to the Main main thread.
Circular Search
Use the set coordinates as the dot to expand the keyword search within the set radius. The sample code is as follows:
EVSearch mEvSearch = new EVSearch(); //Setting parameters mEvSearch.setQuery(EVSearch.Query.newQuery(new SearchArea.Circular(new GeoPoint(116.39750, 39.90850), 5000))); mEvSearch.setListener(new EVSearch.Listener() { @Override public void onSuccess(final POISearchResult result) { //Search succeeded } @Override public void onFail(APIStatus status) { //Search failed } }); //Initiate search mEvSearch.search();
EVSearch.Query Description:
1. Get an instance by the newQuery (SearchArea area) method in EVSearch.Query
2. area: The search area, the circular area is new SearchArea.Circular(GeoPoint point, int radius), the parameter settings are explained as follows:
(1) Parameter point: Geopoint class, the origin of the circle, such as "new GeoPoint (116.39750, 39.90850)".
(2) Parameter radius: int class, search radius, in meters.
Note: The result return interface is an asynchronous thread interface. If the Android project needs to operate the control in the return, it must switch to the Main main thread.
Polygon Search
Draw a polygon based on the latitude and longitude points in order to search for a charging post in this range. The sample code is as follows:
EVSearch mEvSearch = new EVSearch(); //Setting parameters EVSearch.Query mEVSearchQuery = EVSearch.Query.newQuery( new SearchArea.Polygon( new GeoPoint[]{ new GeoPoint(116.43423, 39.93766), new GeoPoint(116.43423, 39.89946), new GeoPoint(116.35448, 39.89946), new GeoPoint(116.35448, 39.93766) } ) ); mEvSearch.setQuery(mEVSearchQuery); //Initiate search mEvSearch.setListener(new EVSearch.Listener() { @Override public void onSuccess(final POISearchResult result) { //Search succeeded } @Override public void onFail(APIStatus status) { //Search failed } }); //Initiate search mEvSearch.search();
EVSearch.Query Description:
1. Get the instance via the newQuery (SearchArea area) method in EVSearch.Query.
2. area search area, polygon area parameter setting new SearchArea. Polygon (GeoPoint[] geoPoints), parameter geoPoints is an array of coordinate points.
Note: The result return interface is an asynchronous thread interface. If the Android project needs to operate the control in the return, it must switch to the Main main thread.
Search Along the Way
Search along the path keyword with the set route coordinate sequence. The sample code is as follows:
EVSearch mEvSearch = new EVSearch(); // Set the request parameters, GeoPoint[] geoPoints=new GeoPoint[2]; geoPoints[0]=new GeoPoint(116.39750, 39.90850); geoPoints[1]= new GeoPoint(116.43423, 39.93766); mEvSearch.setQuery(EVSearch.Query.newQuery(new SearchArea.Path(geoPoints))); mEvSearch.setListener(new EVSearch.Listener() { @Override public void onSuccess(final POISearchResult result) { //Search succeeded } @Override public void onFail(APIStatus status) { //Search failed } }); //Initiate search mEvSearch.search();
EVSearch.Query Description:
1. Get an instance by the newQuery (SearchArea area) method in EVSearch.Query
2. area: Search area, set new SearchArea.Path(GeoPoint[] geoPointArray) along the path parameter, and the parameter geoPointArray is the coordinate point array of the route.
Note: The result return interface is an asynchronous thread interface. If the Android project needs to operate the control in the return, it must switch to the Main main thread.