Local Search (Android)

This article describes how to show points of interest near the user's location using the Android SDK.

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);
    }
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.