Android Google Maps: How to get the area which is currently shown in screen device?

longi picture longi · Apr 17, 2013 · Viewed 13.3k times · Source

Is there a way to get the coordinates of the current area, which is shown at the device?

Background is, we want to show "nearby" places, which are stored in our own database. So let's say, the user looks at following clip of a map:

enter image description here

How do we get the longitude/latitude of the screen (or the point in the middle of the screen and a radius which covers everything?). Please keep in mind, center of the map is not usually the current position, since the user can move the center of the card!

Answer

MaciejGórski picture MaciejGórski · Apr 17, 2013

Use map.getProjection().getVisibleRegion(). From VisibleRegion you can get LatLngBounds, which is easy to work with. You may also try directly with the region, which might be trapezoid.