android-maps-v2

Android: Build Polygonal Shape Geofence

喜欢而已 提交于 2019-11-28 00:11:50
According to the API documentation, only Circular shape Geofences allowed: https://developers.google.com/android/reference/com/google/android/gms/location/Geofence.Builder And it's looks for example: https://developer.android.com/training/location/geofencing.html But I have 4 locations, representing 4 corners of rectangle, and I want my Geofence to be that rectangle. I want to avoid solution of building my custom location monitoring service extending the functionality of monitoring Geofences, because I think this kind of services are CPU & power consuming... Thanks, You have to do it by

How to attach a flexible marker on map something like Uber and Lyft?

自闭症网瘾萝莉.ら 提交于 2019-11-28 00:09:41
How to attach a flexible marker on map something like Uber and Lyft ? am using Google maps v2. Basically, i want to display a marker on map while the position of the marker is changed upon moving the map. edited: Ok i solved my problem. first : add an imageview to the same layout and position equal to center. second: to get the coordinate of the center of the map use the following approach 1- get viewgroup ( FrameLayout ) in my case where the map fragment is located. FrameLayout myContainer = (FrameLayout) findViewById(R.id.content_frame); int mapHeight = myContainer.getHeight(); int mapWidth

Android Map V2 - Why MAPS_RECEIVE permission

做~自己de王妃 提交于 2019-11-27 23:26:06
Consider this as a wiki question. While I setup my project to support Map V2, There has been a step to add MAPS_RECEIVE permission. <permission android:name="com.example.mapdemo.permission.MAPS_RECEIVE" android:protectionLevel="signature"/> <uses-permission android:name="com.example.mapdemo.permission.MAPS_RECEIVE"/> Why we creating and consuming the permission from the app itself? Is that google play services app interact using this permission ? This permission can't takes care of these things? <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/> I

Google Maps Android API v2 SupportMapFragment memory leak

雨燕双飞 提交于 2019-11-27 23:13:20
问题 Using 2 simple activities. First Activity which only holds a button to start the 2nd Activity which holds the map: Main Activity: public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void goToMap(View view){ //This is just the onClick method for the button Intent intent=new Intent( this, BigMapTest.class); startActivity(intent); } The map activity: public

Change marker size in Google Maps API v2

て烟熏妆下的殇ゞ 提交于 2019-11-27 20:26:24
I'm trying to port my app to the brand new Google Maps API v2, but can't find how to change the size of the marker (some of my markers are smaller than default). In v1, I used a Drawable which I scaled with setBounds() before adding it to the map. But now, in v2, I can't use a Drawable . I've to use MarkerOptions().icon() , which takes just a BitmapDescriptor (generated with a BitmapDescriptorFactory ). Looking at the reference, there doesn't seem to be any support for setting or changing the BitmapDescriptor size. So, have I missed something, or is it just plain impossible to set the size for

what makes my map fragment loading slow?

我是研究僧i 提交于 2019-11-27 17:51:38
Performance Enhancement: Previously I saved ALL images in drawable folder, this might be the reason why the map first loads slow, when draw the markers on screen, the image may not fit the screen size. Now I saved images in drawable-mdpi , drawable-hdpi and so on, the app works smoother than before. Hope it helps Original Question: I created a map in a fragment, the source code can be found below. The map fragment is sluggish when the first time it loads. If I go any other fragment and click the map fragment again, it loads fast and no slug anymore. Can anyone tell me what is going on here?

Moving MapFragment (SurfaceView) causes black background flickering

半世苍凉 提交于 2019-11-27 17:14:50
I'm trying to implement new Android Google Maps API (v2). However it doesn't seem to go well with SlidingMenu . As you may know, MapFragment implementation is based on SurfaceView . The problem is that the SurfaceView doesn't like moving it around - I mean placing it in movable views: ViewPager , ScrollView , ListView , or the aforementioned SlidingMenu . When you move it, it leaves a black hole in the place where its pixels originally layed. It looks something like this . This problem can be partially solved by specifying a transparent background on the SurfaceView or even placing a

Move all the markers on the map to their updated/new current location periodically as users moves

∥☆過路亽.° 提交于 2019-11-27 16:27:10
I'm developing an android app where some users opens the same activity from their devices. There is a map in this activity and as users opens this activity from their devices, their location coordinates is fetched from Firebase and a marker based on these coordinates is shown on the map. Here's my code: acceptingUserReference.child(requestID).child(key).addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { if (dataSnapshot.getValue() != null) { final Map<String, String> newAcceptedUser = (Map<String, String>) dataSnapshot

Set a max zoom level on LatLngBounds builder

落花浮王杯 提交于 2019-11-27 10:09:11
问题 I haven't found an answer in my search, there are a few answers on SO but they didn't work for me. I have 2 markers on the map and I am using LatLngBounds builder in order to let the camera zoom to the right zoom level to include them both. Everything works as expected aside one thing, when the 2 markers are really close to each other, the map is very very zoomed and well, it doesn't make any sense to have this level of zooming. LatLngBounds.Builder builder = new LatLngBounds.Builder();

Android Google Map how to check if the gps location is inside the circle

三世轮回 提交于 2019-11-27 09:38:10
问题 I'm trying to detect if a user is in the radius of a Marker , using the users gps location. I have the marker's coordinates, but I don't know how to calculate whether the user is in the area. I've tried to use the following, but even when the current location is inside the circle I keep getting the "outside" message. public class MapaEscola extends FragmentActivity { private GoogleMap googleMap; private Serializable escolas; private ProgressDialog dialog; private Circle mCircle; private