Getting business names or landmarks from lat / long on Android

Ok, so I searched quite a bit of time on this.

I have lat / long from my new found location. geocoder getFromLocation returns a certain number of addresses from lat / long, and this is all fine and dandy. Then I put it in the adapter that the spinner fills ... also works fine.

Now I need to get company names instead of addresses. I would prefer to use lat long and get all enterprises at a certain distance, because not all addresses returned from getFromLocation are complete. Some of them are just neighborhoods or countries.

This link does a good job, although I have not implemented it yet. In my opinion, this seems like a lot of processing power for what should be pretty standard from a big wig like Google.

http://www.smnirven.com/?p=39

Thanks in advance.

public void getFeature() {
    double lat = currentLocation.getLatitude();
    double lon = currentLocation.getLongitude();
    Geocoder gc = new Geocoder(getBaseContext(), Locale.getDefault());

    try {
        List<Address> tmpfeatures = gc.getFromLocation(lat, lon, 15);
        Iterator itr = tmpfeatures.iterator();
        while (itr.hasNext()) {
            featuresAdapter.add(((Address) itr.next()).getFeatureName().toString());
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}
+3
source share
1 answer

Google Places API Register to preview the developer.

https://developers.google.com/places/documentation

+1
source

Source: https://habr.com/ru/post/1773156/


All Articles