I am using the Geocoder class in android studio and I am able to get country name and address by doing
Geocoder geocoder = new Geocoder(this, Locale.getDefault());
List<Address> addresses = geocoder.getFromLocation(latitude, longitude, 1);
if (addresses != null && addresses.size() > 0) {
userCountry = addresses.get(0).getCountryName();
userAddress = addresses.get(0).getAddressLine(0);
}
What I want to do now is to categorize the location. Let`s say if I'm near a park I will translate the latitude and longitude to "park" or if I'm at the beach it will categorize the location as "beach". Is there anything I can use to categorize these places automatically using longitude and latitude?
I thought maybe
addresses.get(0).getLocality()
but it just gives me city name
and when I tried
addresses.get(0).getFeatureName()
it just gives me a number so I'm not sure what that number is.
You could use your longitude and latitude along with Google Places API .
Through the API you will be able to tell if a user is near a city-based location such as a gym or a park.
You can find more information about this API here.