I am writing an app that uses Google Maps Android API V2. The app will center on a specific latitude and longitude (this position is hard coded to 36.5323, -87.3546) when the user turns on the map and get the user's position every 15 seconds. However, when the user first turns the camera on it centers to (8.407168163601076,-87.35459994524717).
This only happens when the user first turns the map on. If the map is turned off and then turned back on, it centers on the correct coordinates. This has only happened on a Nexus 9. I have two other devices for testing where it properly centers the map on the first try.
This is the code I call to center the map:
LatLng pos = new LatLng(36.5323, -87.3546);
CameraUpdate center = CameraUpdateFactory.newLatLng(pos);
CameraUpdate zoom = CameraUpdateFactory.zoomTo(14);
map.moveCamera(center);
map.animateCamera(zoom);
Can anyone tell me why this is happening?
try this
LatLng pos= new LatLng(LATITUDE, LONGITUDE);
CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(latLng, 16);
map.animateCamera(cameraUpdate);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With