简体   繁体   中英

Blue screen in Android Google Maps

I am getting a blue screen when I load my Google Maps on Android. I don't know what I am doing wrong, this is my code for getting the locations:

MapView mapView = (MapView) findViewById(R.id.mapDire);
Route route = directions(new GeoPoint((int)(2*1E6),(int)(34*1E6)),
  new GeoPoint((int)(3*1E6),(int)(36*1E6)));

I think can be two things

  • Your coordinates are 0,0 and the map is opening in the ocean
  • Something wrong with your API Key

In the first case try zoom out a lot of times and try to see some continent.

In the second try to read the documentation or/and try this link

I hope this helps.

I have this problem in my application and see below code in onlocationchanged method and resolve it.

LatLng myCoordinates = new LatLng(location.getLatitude(), location.getLongitude());
         mMap.moveCamera(CameraUpdateFactory.newLatLng(myCoordinates));

    mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(location.getLatitude(), location.getLongitude()), 17.0f));

    marker.setPosition(myCoordinates);

Normally blue screen means your Google API key didn't work.

GoogleMaps - Actual Map not showing

If your map is not showing, only grids/blank screen showing, that's because your Map API key is missing or incorrect. Sign up for Google Android Map API.

Try this the link for more info.

There could 3 reasons as to why You see blue screens

  1. Your Long/Lat Points to Water region - or Ocean region, Invariably there's nothing wrong just you Long/Lat Pointing to Water which is blue in color.
  2. Your Long/Lat is wrong and nothing comes up
  3. Your API key is wrong which can be corrected on your Android manifest file directory: Android/app/src/main/AndroidManifest.xml

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM