I was trying to get latitude and longitude of center of the map. I am using Fragment to show map that is,
SupportMapFragment fm = (SupportMapFragment) getSupport
You are requesting the camera position when the map was not yet loaded, therefore the camera is pointing to 0.0, 0.0. Instead use this:
googleMap.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() {
@Override
public void onMapLoaded() {
Log.e("TAG", googleMap.getCameraPosition().target.toString());
}
});