How to detect panning on GoogleMap - android

I am trying to plot some markers on my Application using Google Maps.Initially the application displays some markers at around current location.Then after panning on map new markers have to be displayed on new camera position.This should be displayed after the user have stopped panning.Currently the markers are stored in remote database.After user have stopped panning markers have to be loaded by calling webservice.
The problem is that how can i detect the panning on map and when the panning have stopped.Google maps OnCameraChangeListener() cannot be implemented because it detects all changes on map including zoom change thru code also.I have to detect the pann change thru touching on map only because there is lot of zoom and camera changes thru code also.
I followed the github link
Actually I am not getting the correct idea how to implement the MapStateListener in my map View activity.
and many other links in Stack Overflow but cannot get any solution while implementing.

Related

Android Map animateCamera does not reload map

In my Android app I have to move the camera and draw a custom marker in the LocationCallback() everytime I get a location update when driving in a car. However It works fine. I just noticed that when I'm, using
gMap.moveCamera(CameraUpdateFactory.newLatLng(LatLng(location.latitude, location.longitude)))
the map loads the needed parts when driving to a new location. But I dont like that moveCamera 'jumps' from a location to a new location. Using
gMap.animateCamera(CameraUpdateFactory.newLatLng(LatLng(location.latitude, location.longitude)))
is just as smooth as I expect it to be, but in this case the map does not reload new contents so I'm driving in the middle of the fog of war!
Is there a possibility to get a smooth camera position update including a reloaded map?

Hotspot markers in Google Streetview

I am building an android app and I am trying to figure out a way to place custom markers in Google Streetview, something like hotspots that display images when clicked and move along with the camera so that they go off screen if necessary. I have no experience at all, so I would at least understand where to start studying.
Would it be possible with CSS position properties?
Edit: I am searching for a way to locate them in street view mode, not in map mode.
Marco! Work with markers is very simple. For drag-drop marker you should override methods onMarkerDragStart, onMarkerDrag, onMarkerDragEnd. All click on marker call infoWindow. So, you can set your InfoWindowAdapter to map and implement your code logical here.
For concurrent moving camera with marker (right me understand?). Unlike ios version of google map, you can catch only final position of your camera (analoge idleCameraPosition on ios). So, i think you have to move marker first, and after it set camera to marker position
The best way to understand simple things of android google map is https://developers.google.com/maps/documentation/android-api/signup

android google map ~10k markers

i am doing an android app, that is displaying markers on google map. The problem here is i need to handle ~10k markers. I can't do clustering as every marker is important and i can't show this markers from some zoom level as it is important to get the 'bigger picture'
WHAT I'VE TRIED:
displaying only visible markers, but they are too dense and still I am left with few thousands and map just can't handle it..
I moved away from google markers and created surfaceview over map fragment. And this works fine when I update my 'markers' after google map camera changes (after u stop dragging it), but this looks bad, because in between updates they are anchored to its position on screen not on map. And when i try to update my surfaceview while dragging it is not doing too well and freezes.
QUESTIONS:
will moving from surfaceview to opengl improve rendering time?
any other ideas?
EDIT:
firstly i will clarify, important is not every single marker, but the shape of the cloud of markers.
And also I've already tried heatmaps from google maps extension, but it kept freezing while dragging the map, heap kept growing until it finally breaks.
Rendering markers in google map is very resource expensive task. If the marker is custom designed it will take more time to just to create the bitmap.Traditional way of creating marker will not help here, bcz rendering is done by Main Thread. You have to implement some parallel processing to create the markers, So redering markers will not disturb your main thread. You can implement something like this
http://leaks.wanari.com/2016/05/05/rendering-markers-for-android/
I hope it will help you. Good Luck.

How to make a Custom marker on google maps disappear if it is not in focus

Some of the markers in google maps appear when zoomed in. However, when a user drag the map into a different place, the marker disappears, and when you drag it again on the previous place, the marker starts to animate in front of you (I hope you are getting what I'm trying to say). I want to know if there is such a way to do that. Thanks.
The same thing happens in Google Maps Android API v2 on street names, parks, etc.
There is no support for marker transparency as of this writing. You will have to code it yourself: posting to Handler until the animation finishes and setting new icon every "frame" with increasing opacity.

Show a moving bus in google maps api v2 android

I am trying to show the position of a moving bus in google maps api v2 in an android application. I am able to mark the stops and draw routes using the markers and polylines. Now, I am trying to have an image(bus/Marker) that moves along the route that is there in the map. I am using GroundOverlay to achieve this, but I am not able to re draw the moving image/marker using GroundOverlay.
The problem I am facing is that, as I am drawing the map in the OnCreate function, the map, markers, routes and all the positions of the moving marker are displayed only once at the end of the oncreate function. I think I am going in the wrong direction. Is there a way to redraw only the moving marker? Is it possible to have a view on top of a map and draw on the view using projection? (is this possible in V2? If Yes, do we have some demo or sample available online?)

Categories

Resources