I am working on google maps in my application. Now in android the map is not being displayed although I have checked the code it's fine and everything is working.
The steps I have checked and they are working fine: 1) the SHA code is fine. 2) The key I inserted in application is fine. 3) I have enabled the map API for my application.
But the logcat displays the following when I access the map fragment:
06-22 18:57:47.380 8417-10561/ I/b: Sending API token request.
06-22 18:57:50.300 8417-10561/ E/b: Authentication failed on the server.
06-22 18:57:50.300 8417-10561/ E/Google Maps Android API: Authorization failure.
Please see https://developers.google.com/maps/documentation/android-api/start for how to correctly set up the map.
06-22 18:57:50.300 8417-10561/ E/Google Maps Android API:
In the Google Developer Console (https://console.developers.google.com)
Ensure that the "Google Maps Android API v2" is enabled.
Ensure that the following Android Key exists:
API Key: AIz------------------------------------S
Android Application (<cert_fingerprint>;<package_name>): SHA-1FingerPrint;PackageName
Now I have searched through internet regarding this issue and I haven't found a solution yet. I have gone through the following questions but no result.
Google Maps V2 not working in production with correct key
Google Maps Android API v2 Authorization failure
This is my activity code for the map:
private void setupWebView(View parentView) {
loading = (ProgressBar) parentView.findViewById(R.id.loading);
loading.setVisibility(View.GONE);
if (googleMap == null) {
googleMap = ((MapFragment) getActivity().getFragmentManager().findFragmentById(R.id.mapf)).getMap();
}
setupMarkers(searchCenters.getText().toString());
}
private void setupMarkers(String searchFor) {
googleMap.clear();
if (searchFor == null || searchFor == "") {
for (Center center : centers) {
markers.add(
googleMap
.addMarker(new MarkerOptions()
.position(new LatLng(center.getAddress().getLatitude(),
center.getAddress().getLongitude()))
.title(center.getName()).visible(true)));
}
} else {
for (Center center : centers) {
if (center.getName().toLowerCase().contains(searchFor.toLowerCase())) {
markers.add(
googleMap.addMarker(new MarkerOptions()
.position(new LatLng(center.getAddress().getLatitude(),
center.getAddress().getLongitude()))
.title(center.getName()).visible(true)));
} else {
markers.add(
googleMap.addMarker(new MarkerOptions()
.position(new LatLng(center.getAddress().getLatitude(),
center.getAddress().getLongitude()))
.title(center.getName()).visible(false)));
}
}
}
And the result is like this:
Can anybody help me with this issue. I know this has been asked many time here but still I can't find the answer.