Google Maps Android API v2 – Sample Code crashes

Follow the crib sheet very, very carefully: https://docs.google.com/document/pub?id=19nQzvKP-CVLd7_VrpwnHfl-AE9fjbJySowONZZtNHzw In particular, I think you need to: Import the actual source for the “google-play-services_lib” project and link it as an Android library. Do this through Project -> Properties -> Android -> Library, Add -> google-play-services_lib (you can right click on your project and choose Properties, then select … Read more

Android: Google Maps location with low battery usage

FINALLY FOUND THE SOLUTION!!! thanks to Tristan for his answer! By default, GoogleMap uses its on location provider, which is not the Fused Location Provider. In order to use the Fused Location Provider (which allows you to control the location accuracy and power consumption) you need to explicitely set the map location source with GoogleMap.setLocationSource() … Read more

SupportMapFragment does not support AndroidX Fragment

This issue has already been reported to Google in the public issue tracker: https://issuetracker.google.com/issues/110573930 I would suggest starring the feature request in the public issue tracker to add your vote and subscribe to further notifications from Google. Hopefully, Google will implement it in next versions of Android Maps SDK. Update Google has provided the following … Read more

Display toolbar for Google Maps marker automatically

The overlay that appears when a marker is clicked, is created and destroyed on-the-spot implicitly. You can’t manually show that (yet). If you must have this functionality, you can create an overlay over your map with 2 ImageViews, and call appropriate intents when they’re clicked: // Directions Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse( “http://maps.google.com/maps?saddr=51.5, 0.125&daddr=51.5, … Read more

Ensure that the “Google Maps Android API v2” is enabled. I am getting this error when I try to Implement Google Maps

From error it is clear that You did not enable google map api for android. To enable, Login google developer console Select Library option from left side panel. Now you can see all API list and go to Google Maps APIs and select Google Maps Android API . Now you can see option to enable/disable … Read more

Android Google Maps API V2 Zoom to Current Location

Try this coding: LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); Criteria criteria = new Criteria(); Location location = locationManager.getLastKnownLocation(locationManager.getBestProvider(criteria, false)); if (location != null) { map.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(location.getLatitude(), location.getLongitude()), 13)); CameraPosition cameraPosition = new CameraPosition.Builder() .target(new LatLng(location.getLatitude(), location.getLongitude())) // Sets the center of the map to location user .zoom(17) // Sets the zoom .bearing(90) // Sets the orientation … Read more