Android: Find a location from the location name. Is Android Geocoder correct?

I am trying to create a location based app that displays a google map and allows the user to search for a location by writing down the address (like google maps do).

I am trying to use android geocoder for this and it finds some addresses. However, one of the first addresses I tried (vaasankatu, helsinki, finland) it didn't find when I looked for the street name (vaasankatu). Also one other street name I've tried doesn't return any results. If I add a city (Helsinki) or a country (Finland) after the street name, the geocoder will find the addresses.

Google maps web app and android app finds addresses without any problem just by searching by street name. I'm wondering if I can somehow get the geocoder to return an address when it searches by street name? I could of course try to find out the current city with a geocoder and attach it after the request, but this seems like a hack, is there a better way?

I'm also a little worried about the geocoding documentation , which says:

"The Geocoder class requires a backend service that is not included in the main android framework. The Geocoder query methods will return an empty list if there is no backend service on the platform. Use isPresent () to determine if the Geocoder implementation exists."

I don't quite understand what this means. So are there most of the phones that don't support geocoder? The text seems to suggest that there might be, but why not have such an api at all? Should I be using a different api alltogether? For example, is the Google geocoding api for web services commonly used? Or api locations?


source to share

All Articles