google-maps-android-api-2

Android: automatically choose debug/release Maps v2 api key?

人盡茶涼 提交于 2019-11-26 21:55:39
I'm using Google Maps v2 API in my project. In Google Maps v2 the debug/release API key is defined in AndroidManifest.xml . I have seen the link but in that map key is defined in a xml layout file not in AndroidManifest.xml . So can I define both debug and release keys for my project in AndroidManifest.xml ? I want something like this in AndroidManifest.xml : If debug mode: <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="@string/debug_map_api_key"/> If release mode: <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="@string/release_map_api

MapActivity query for nearest hospital/restaurant not working

醉酒当歌 提交于 2019-11-26 21:41:28
问题 EDIT: Resolved! In addition to Daniel's answer (saved my life), here's what I did: 1. Replaced the 'MapActivity2' class to a server API key. 2. Let the other keys in the manifest and 'maps_activites.xml. be the android API key 3. Enable the following APIS on Google Developer APIS: Google Maps Android API Google Places API for Android Google Places API Web Service 4. BOOM! It worked. Here's the code to my github repository in any case: https://github.com/bholagabbar/AurumHealthApp I am trying

Android Maps v2 rotate mapView with compass

偶尔善良 提交于 2019-11-26 20:58:30
问题 I'm developing an app which needs to rotate the mapView with a compass. I know how to rotate the camera but I need to rotate the mapView with the compass. the center point should be the current location. I found codes for Maps V1 but I need to do it with Maps V2 回答1: OK, i figured it out myself. first you need to calculate the bearing from the compass. then the Maps api-2 camera can be rotated. public void updateCamera(float bearing) { CameraPosition currentPlace = new CameraPosition.Builder(

Google Maps Android API v2 throws GooglePlayServicesNotAvailableException, out of date, SupportMapFragment.getMap() returns null

给你一囗甜甜゛ 提交于 2019-11-26 20:54:04
问题 I am trying to incorporate the new Google Maps Android API v2 into an application using the Android Support Library. I've gone through many iteration to try to get somewhere to work and now I have given up and thought I should ask here. I went to the API Console, created a project, enabled Google Maps API v2 for Android, created a debug KEY as required and pasted it on the manifest. No authentication problems or anything like that. Pretty sure I did this right. In my project's libs folder I

Google Maps V2 - Android - Get a list of Markers

偶尔善良 提交于 2019-11-26 20:49:33
问题 I'm trying to get a list Markers(using GMaps V2 for Android) similar to the getOverlays() method I used in GMaps V1.1 for Android here: private MapView mapView; mapView.getOverlays().add(overlay); How can I do something similar to what I did above but with Markers? Any help would be appreciated. 回答1: How can I do something similar to what I did above but with Markers? When you call addMarker() , save the resulting Marker object in a collection of your choice (e.g., ArrayList<Marker> ). 回答2:

Google maps suddenly not working

一笑奈何 提交于 2019-11-26 20:45:24
问题 All of a sudden maps stopped working in my app and just shows a blank screen with the google logo in the bottom left corner. The error I get is: I/Google Maps Android API﹕ Google Play services package version: 4452038 I/ActivityManager﹕ Start proc com.google.android.gms.maps for service com.google.android.gms/.maps.auth.ApiTokenService: I/Google Maps Android API﹕ Google Play services client version: 4452000 I/Google Maps Android API﹕ Failed to contact Google servers. Another attempt will be

Add markers dynamically on Google Maps v2 for Android

我与影子孤独终老i 提交于 2019-11-26 20:22:46
问题 what are the possibilities to add markers dynamically depending on the area of the map which is shown? I have a lot of markers or let´s say my markers need a lot of performance to be rendered, cause they are custom. I implemented it now, that only 40 markers are drawn when a "camerachange" was fired. So at this time i always render 40 new markers when cameraposition was changed. I read about runnable and handler, are their more options? Does someone know which of these possibilities is the

GooglePlayServicesUtil.getErrorDialog is null

喜夏-厌秋 提交于 2019-11-26 19:59:30
问题 I'm using ACRA (arca.ch) to generate automatic error reports. I just released a new version of my app using Google Maps Android API v2. I'm getting an error reported by EEEPad and Transformer Pad users when trying to show the dialog returned by GooglePlayServicesUtil.getErrorDialog. Does anyone know why this might happen? Here is the relevant code and Logcat as reported by acra: While calling this line: int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this); if(resultCode

Google Maps API v2 SupportMapFragment inside ScrollView - users cannot scroll the map vertically

心不动则不痛 提交于 2019-11-26 19:43:15
I am trying to put a Google map inside a scroll view, so that the user can scroll down other contents to see the map. The problem is that this scroll view is eating up all the vertical touching events, so the UI experience of map becomes very weird. I know that in V1 of the google map, you could override onTouch, or setOnTouchListener to call requestDisallowInterceptTouchEvent upon MotionEvent.ACTION_DOWN. I have tried to implement the similar trick with V2 to no avail. So far I have tried: Override SupportMapFragment, and inside onCreateView, set a on touch listener for the View call .getView

Custom marker in google maps in android with vector asset icon

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-26 19:14:49
问题 How can we achieve a map marker icon with vector asset file, the way google shows it like this, programatically: Update: map.addMarker(new MarkerOptions() .position(latLng) .icon(BitmapDescriptorFactory.fromResource(R.drawable.your_vector_asset)) .title(title); this doesnot work when dealing with vector assets. The main reason to ask the question. The error with the above code: java.lang.IllegalArgumentException: Failed to decode image. The provided image must be a Bitmap. 回答1: I was looking