Local Search (Android) Follow
This article describes how to show points of interest near the user’s location using the Android SDK. The underlying Local Search API has some limitations you should understand before using it in your application.
Using Local Search
You can use the LocalSearch classes to find points of interest near a user’s location. You’ll usually use this in conjunction with MeridianLocationManager so that you can provide a location and nearby placemarks.
For best performance, limit local search results to 20 or less.
// This Activity implements the LocalSearch.LocalSearchListener interface private void findNearbyCafe() { LocalSearch localSearch = new LocalSearch.Builder() .setQuery("Cafe") .setApp(appKey) .setLocation(locationManager.getLocation()) .setListener(this) .setLimit(20) .build(); localSearch.start(); } @Override public void onSearchComplete(LocalSearchResponse response) { for (LocalSearchResult result : response.getResults()) { Log.i(TAG, String.format("%s is %f seconds away", result.getPlacemark().name, result.time / 1000)); } } @Override public void onSearchError(Throwable tr) { Log.e(TAG, "Search error", tr); }
Comments
0 comments
Please sign in to leave a comment.