google-maps-android-api-2

How to handle Location Listener updates inside a Service in Android?

杀马特。学长 韩版系。学妹 提交于 2019-12-04 13:21:41
问题 I am working on an app that should get accurate user location continuously if user is inside a specific zone. The location updates should be saved on a server (Parse.com) so other users can get the current location of the user. The flow is: Application onCreate --> start Service with LocationListener --> onLocationChanged --> save new location on Parse.com --> Parse.com Cloud afterSave method send push notification to users --> other users get notifications via broadcast reciever --> update

Android Draw polylines with arrow on google map with direction path

情到浓时终转凉″ 提交于 2019-12-04 13:13:50
问题 I have added polylines but not able to add arrow with direction on google map should be display as below And when it zoom up, more arrow should be display like below I have tried reading various blogs and codes but not able to get the goal I have used following code snippet below: private void DrawArrowHead(MarkerOptions MO, GoogleMap mMap, LatLng from, LatLng to) { // obtain the bearing between the last two points double bearing = GetBearing(from, to); // round it to a multiple of 3 and cast

OnCameraChangeListener is not responsive enough - is there another way?

六月ゝ 毕业季﹏ 提交于 2019-12-04 12:37:26
I am porting a layer I have in a v1 map to v2. The layer draws a custom control on the map and, as the map moves, it must stay in place on its current geolocation (w/ the correct scale). It had been suggested to me to use onCameraChange to communicate to my layer (a custom view, on top of the map) that the camera was panning or zooming and update the layer appropriately. My problem is that onCameraChange is only called after the camera has been moved - not during. It is therefor not responsive enough. Is there another way to achieve this? chose007 Try to wrap the MapFragment (or MapView)

Determine if Polygon is Within Map Bounds

喜欢而已 提交于 2019-12-04 12:37:13
I have a big list of polygons (consisting of google maps polygon options) which I would like to check if they are within the bounds of the screen before drawing them. How do I determine if the polygon is within the screen bounds. Something like this: List<PolygonOptions> polygons = getPolygons(); LatLngBounds bounds = map.getProjection().getVisibleRegion().latLngBounds; for (int l = 1; l <= polygons.size(); l++) { if (bounds.Contains(polygons.get(l))) { map.addPolygon(polygons.get(l)); } } I suppose that you don't need to check if each point from polygon are visible - you should do it for only

How to add markers on a map as users opens the activity, and update the realtime location of each marker as users move?

不羁的心 提交于 2019-12-04 12:35:57
I have an activity in my app which has a Map in it and as users opens this activity from their devices, a marker is added showing their current location and then an inner Service class in which the code of updating the realtime location goes. Here's my code: mDatabase.child(rID).addChildEventListener(new ChildEventListener() { @Override public void onChildAdded(DataSnapshot dataSnapshot, String s) { if (dataSnapshot.getValue() != null) { Map<String, String> newAcceptedUser = (Map<String, String>) dataSnapshot.getValue(); pAccepted = newAcceptedUser.get("pName"); uidPAccepted = newAcceptedUser

Google Maps V2 + Drawer Layout

萝らか妹 提交于 2019-12-04 12:32:20
I have tried to add a drawer layout(from android tutorial) to a "hello world" Google Maps App. The problem is you cannot click items on the sliding menu. I think there's an issue with the fragment part in the xml. I've tried to find a workaround but none worked. Any ideas how to add it in a different way to make it work? Here's the activity code: public class MainActivity extends FragmentActivity { private GoogleMap mMap; private SupportMapFragment fragment; private DrawerLayout mDrawerLayout; private ListView mDrawerList; private ActionBarDrawerToggle mDrawerToggle; private CharSequence

osmdroid, Maps API v2, and fragments

痞子三分冷 提交于 2019-12-04 12:18:47
问题 Ok. You'd think this would be relatively simple, but nope. I am using Open street maps on my website, as the data is free to use, edit, and update - my project follows this mantra, and alongside googles API usage restrictions/saving data restrictions, google maps simply was not suitable for me.. at least on the web. Given this I thought i'd follow suit with my android app, and so I setup osmdroid utilizing open street maps data. I can have a nice map in my activity.. I also followed a

How to add text above polyline in google maps?

为君一笑 提交于 2019-12-04 12:17:20
问题 I have 2 markers, I would like to draw a line between them, and have a text showing the distance above the line, just like in the web version of google maps. I've already found this sample about drawing a line between 2 markers, but how do I add text above the line? 回答1: One idea would be to calculate the midpoint between the two markers using their lat and long coordinates and then put an infowindow with whatever information you want to show. Or something like the following could help: Link

Google MAPs API for android limit 2500 requests/day is per client device or per application key?

拈花ヽ惹草 提交于 2019-12-04 10:48:50
问题 Sorry, I found similar questions - but not the answers: only discussions. I'm developing android application which is intended to place points and draw routes on map. In case Google limits using of their maps 2500 r/day per key - there is no way to use it, since even in case your application was once sold - you'll need to pay every month for every additional 1000 req/day. Especially it is unclear for free application: how much it will cost for 100000 downloads per month after 1 year? Please,

zoom over specific route google map

こ雲淡風輕ζ 提交于 2019-12-04 10:15:39
问题 I have a list of random latitude and longitude points and I am drawing a route between them. My question is how to bound this route within google map I made below utility method public static void drawRouteIntoMap(final List<? extends MapHelper> position, final GoogleMap googleMap) { /*List<MapHelper> position = new ArrayList<MapHelper>(); for (int i = lastPosition; i < maps.size(); i++) { position.add(maps.get(i)); }*/ if (position.size() > 0 && Validator.isNotNull(googleMap)) { googleMap