google-maps-android-api-2

Adding Google Play services version to your app's manifest?

耗尽温柔 提交于 2019-11-26 06:01:01
问题 I\'m following this tutorial: https://developers.google.com/maps/documentation/android/start#overview on how to add Google Maps to an app within the Android SDK. The only problem I seem to be having is during this bit (I\'ve done everything else with no errors): Edit your application\'s AndroidManifest.xml file, and add the following declaration within the <application> element. This embeds the version of Google Play services that the app was compiled with. <meta-data android:name=\"com

Google Maps API v2: How to make markers clickable?

强颜欢笑 提交于 2019-11-26 05:59:42
问题 How to I make the markers in Android Google Maps API v2 become clickable so they will either bring up a menu with options or just start a new activity? I believe I made the markers in my app currently in a \"newb\" method. I didn\'t assign them a name or a method to be able to link it in with the rest of the required code. googleMap.addMarker(new MarkerOptions() .position(latLng) .title(\"My Spot\") .snippet(\"This is my spot!\") .icon(BitmapDescriptorFactory.defaultMarker

How do I know the map is ready to get used when using the SupportMapFragment?

狂风中的少年 提交于 2019-11-26 05:54:13
问题 In the onCreate method, I am making use of the SupportMapFragment to show a map. SupportMapFragment fragment = new SupportMapFragment(); getSupportFragmentManager().beginTransaction() .add(android.R.id.content, fragment).commit(); In conjunction to this, I would like to add a marker. The problem is when the call to getMap is null, when can I try again? Is there an event I can register for or is my approach in and of itself wrong? mMap = ((SupportMapFragment)(getSupportFragmentManager()

Google Maps API v2 draw part of circle on MapFragment

回眸只為那壹抹淺笑 提交于 2019-11-26 05:32:03
问题 I need to draw something like this which will be painted and have little transparency Also it needs to be clickable (onTouch event etc) I know that in API v1 you have to use Overlay and extend it using canvas and some mathematics. What is easiest way to do it in Google Map API v2? PS: Radius is variable. (For further reference) EDIT 1: I implemented CanvasTileProvider subclass and override its onDraw() method: @Override void onDraw(Canvas canvas, TileProjection projection) { // TODO Auto

Change position of Google Maps API&#39;s “My location” button

我是研究僧i 提交于 2019-11-26 05:17:52
问题 I am using the Google Maps Android API v2, and I need a way to chance the position of the \"My Location\" button. I get the \"My Location\" button like this: GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext()); final GoogleMap map = ((SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map)).getMap(); // This gets the button map.setMyLocationEnabled(true); 回答1: Just use GoogleMap.setPadding(left, top, right, bottom), which allows you to indicate

Animating markers on Google Maps v2

扶醉桌前 提交于 2019-11-26 04:19:40
问题 What is the best way to animate markers on Google Maps using v2 API? I am working on a map-centered game where I track locations of people and display them on the map for each other to see. As people move, I want to animate a marker from his current to his latest position. Every person has a direction, so I need to rotate the marker appropriately. What is the best way to do it using the new Google Maps API? 回答1: Some Google engineers have provided a nice demo video with some elegant sample

Get driving directions using Google Maps API v2

倖福魔咒の 提交于 2019-11-26 03:19:55
问题 I am trying to get the driving direction between the two positions: LatLng(12.917745600000000000,77.623788300000000000) LatLng(12.842056800000000000,7.663096499999940000) The code which i have tried: Polyline line = mMap.addPolyline(new PolylineOptions(). add(new LatLng(12.917745600000000000,77.623788300000000000), new LatLng(12.842056800000000000,7.663096499999940000)) .width(5).color(Color.RED)); But this draws a straight line between the two points . Is there any other method/way to get

Android map v2 zoom to show all the markers

末鹿安然 提交于 2019-11-26 02:26:51
问题 I have 10 markers in the GoogleMap . I want to zoom in as much as possible and keep all markers in view? In the earlier version this can be achieved from zoomToSpan() but in v2 I have no idea how about doing that. Further, I know the radius of the circle that needs to be visible. 回答1: You should use the CameraUpdate class to do (probably) all programmatic map movements. To do this, first calculate the bounds of all the markers like so: LatLngBounds.Builder builder = new LatLngBounds.Builder()

Blue dot and circle is not shown on MyLocation using android fused location api

泪湿孤枕 提交于 2019-11-26 02:24:19
问题 I was using LocationManager to track the user current location, Now after changing location manager to FusedLocation API, the blue dot and circle is not shown even after setting map.setMyLocationEnabled(true) . I can see the current location icon on top right corner in my map fragment but clicking on it does nothing. I reverted my code to LocationManager now i am able to see the blue dot pointing to my current location. what could be wrong using Fused Location API. 回答1: For targeting api-23

Capture screen shot of GoogleMap Android API V2

走远了吗. 提交于 2019-11-26 01:47:12
问题 Final Update The feature request has been fulfilled by Google. Please see this answer below. Original Question Using the old version of the Google Maps Android API, I was able to capture a screenshot of the google map to share via social media. I used the following code to capture the screenshot and save the image to a file and it worked great: public String captureScreen() { String storageState = Environment.getExternalStorageState(); Log.d(\"StorageState\", \"Storage state is: \" +