google-maps-android-api-2

How to get current Location in GoogleMap using FusedLocationProviderClient

自作多情 提交于 2019-11-27 11:08:50
I want to get periodic (say every 2 minutes) current location updates for this I'm following official documentation, I wrote this code but its not giving current location updates every two minutes even specified in LocationRequest object that I'm passing in requestLocationUpdates(), here is code: public class MapsActivity extends FragmentActivity implements OnMapReadyCallback, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener{ private FusedLocationProviderClient FusedLocationClient; private GoogleApiClient mGoogleApiClient; @Override protected void onCreate(Bundle

Google Maps Android API V2 check if GoogleMaps are installed on device

青春壹個敷衍的年華 提交于 2019-11-27 11:08:02
When using Google Maps Android API V2 I'm following the Google Play Services setup documentation to make a check to ensure that Google Play Services are installed, using the following code in my main Activity: @Override public void onResume() { checkGooglePlayServicesAvailability(); super.onResume(); } public void checkGooglePlayServicesAvailability() { int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this); if(resultCode != ConnectionResult.SUCCESS) { Dialog dialog = GooglePlayServicesUtil.getErrorDialog(resultCode, this, 69); dialog.setCancelable(false); dialog

How can I handle map move end using Google Maps for Android V2?

£可爱£侵袭症+ 提交于 2019-11-27 11:02:08
I want to geocode address as soon as map center has been changed. How can I handle map moveend with new Google Maps for Android V2? (I'm talking about the case then user drags map by finger) AZ13 Here is a possible workaround for determining drag start and drag end events: You have to extend SupportMapFragment or MapFragment. In onCreateView you have to wrap your MapView in a customized FrameLayout (in example below it is the class "TouchableWrapper"), in which you intercepts touch events and recognizes whether the map is tapped or not. If your "onCameraChange" gets called, just check whether

Manage Google Maps API Key with Gradle in Android Studio

会有一股神秘感。 提交于 2019-11-27 10:44:12
I know Gradle is powerful and I would like to manage the API keys for development/produciton of Google Maps Currently I always need to manually comment one line and uncomment the other to make it work. Is there a way to do it automatically in Gradle with some custom release configuration ? <!-- MapView v2 API --> <uses-library android:name="com.google.android.maps" /> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="[MY_DEV_KEY]" /> <!-- PROD <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="[MY_PROD_KEY]" /> --> Since you are using gradle

How to display my location on Google Maps for Android API v2

空扰寡人 提交于 2019-11-27 09:31:34
问题 I've looked high and low for an answer on this, and no one, in any forum question has been able to help. I've searched through the tutorials. The API Guide says: The My Location button appears in the top right corner of the screen only when the My Location layer is enabled. So I've been looking for this My Location layer and have been unable to find anything. How do I show my location on a Google Map? 回答1: The API Guide has it all wrong (really Google?). With Maps API v2 you do not need to

how to control/modify the activity textview from viewpager fragment

 ̄綄美尐妖づ 提交于 2019-11-27 09:06:17
问题 I have a viewpager which has five tab and control the tab with tablayout. the problem that i have is that the title doesn't change when want to go from one activity to another activity. the thing that i do is that i changed the textview title in tablayout in onTabSelected in the activity but in both on select tab and in on reselect tab method but sometimes it doesn't change anymore. another thing that makes the point is the map which i use the address of the map in my main activity title. i

How to Draw Route in Google Maps API V2 from my location [duplicate]

只愿长相守 提交于 2019-11-27 08:28:04
This question already has an answer here: Android: How to draw route directions google maps API V2 from current location to destination 5 answers I want to make direction application but, i have problem to draw route from my location to destination, i get variabel longitude and latitude from my location , but i dont know to draw line .. i want to draw direction to this location = -6.984873352070259,108.48140716552734. please help me guys.. i have read the quetions before but i cant get solution.. thanks.. iam sorry before.. here is my code package com.apps.visitkuningan; import android.app

Adding Markers in Background while Looping through ArrayList

ⅰ亾dé卋堺 提交于 2019-11-27 08:01:09
问题 I add Markers to a googleMap from an ArrayList of Objects. There are about 250 markers; I even have to convert them to bitmaps to customize them. It's a pretty resource intensive task. BUT It seriously blocks my UI thread. Here is how I do it: final HashMap<Marker, NearLocation> markerIdMap = new HashMap<Marker, NearLocation>(); for (final NearLocation result : MainActivity.nearLocationList) { // Do all the hard work here } How can I do this somehow dynamically, after the map loads and it

Minimal Android API level to run Google Maps Android API v2

こ雲淡風輕ζ 提交于 2019-11-27 07:38:15
问题 I have developed a mobile application that uses Google Maps Android API v1, and I plan to port it to the recent Google Maps Android API v2, as recommended by Google. However, my application also targets Android 2.1 devices, and I cannot figure out whether the v2 Maps will run on such devices. I have found some reference suggesting that v2 should work with API level 8 and 10 (here, here and here), provided that OpenGL ES 2.0 is supported by the mobile device, but nothing about API level 7. My

Google Maps v2 Marker zOrdering - Set to top

寵の児 提交于 2019-11-27 07:27:22
I know there are a few threads around on this topic but i havent yet found a good enough solution. I NEED to place a marker over the top of all other markers. How do i do this? I have tried adding this marker before and after all other markers, however the ordering seems to be from bottom (front) to top (back) on the map view. This is not acceptable as I want to center on a marker which is in front of all markers. I know that Polygons can be zOrdered but I would MUCH prefer a nicely styled graphic! In-fact you can't order a Polygon over a marker! "The order in which this polygon is drawn with