How to implement the current location blue icon here Map

I work with the Map SDK here , and I need to show a blue icon with a circle animation for the current location, as in the image.

enter image description here

Can anyone tell me how to do this.

Now I have a code that only sets an icon, which is a blue dot. I donโ€™t know how to add environment animations to it.

Note that the mMap link is a Map object from the Android SDK here .

  mMap.getPositionIndicator().setVisible(true); mMap.getPositionIndicator().setZIndex(0); mMap.setZoomLevel(15); mMap.getPositionIndicator().setAccuracyIndicatorVisible(true); mMap.getPositionIndicator().setMarker(createImage(R.drawable.ic_location_dot)); 
+6
android here-api
source share
8 answers

Enabling MyLocation in Google Map

 googleMap.setMyLocationEnabled(true); 
+2
source share

For javascript you can use

 map.addObject(new H.map.Circle( // The central point of the circle {lat:28.6071, lng:77.2127}, // The radius of the circle in meters 1000, { style: { strokeColor: 'rgba(55, 85, 170, 0.6)', // Color of the perimeter lineWidth: 2, fillColor: 'rgba(0, 128, 0, 0.1)' // Color of the circle } } )); 

There should be a similar implementation for android.

0
source share

Try the following:

 mMap.setMyLocationEnabled(true); 

It enables or disables the level of my location. While location is turned on and accessible, my location layer continuously displays information about the user's current location and bearing and displays user interface elements that allow the user to interact with their location (for example, to enable or disable camera tracking their location and bearing).

Much better if you put it under:

 @Override public void onMapReady(GoogleMap googleMap) { } 
0
source share

I successfully tested this code and called the addPulsatingEffect (Location userLocation) method with the user's current location.

 private Circle lastUserCircle; private static final long PULSE_DURATION = 2000; private static final float RADIUS = 200.0f; private ValueAnimator lastPulseAnimator; private void addPulsatingEffect(Location userLocation){ final LatLng userLatlng = new LatLng(userLocation.getLatitude(), userLocation.getLongitude()); if(lastPulseAnimator != null){ lastPulseAnimator.cancel(); } if(lastUserCircle != null) { lastUserCircle.setCenter(userLatlng); } lastPulseAnimator = valueAnimate(RADIUS, new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { if(lastUserCircle != null) lastUserCircle.setRadius((Float) animation.getAnimatedValue()); else { lastUserCircle = mMap.addCircle(new CircleOptions() .center(userLatlng) .radius((Float) animation.getAnimatedValue()) .strokeColor(Color.BLUE) .strokeWidth(4.0f)); } } }); } protected ValueAnimator valueAnimate(float radius, ValueAnimator.AnimatorUpdateListener updateListener){ ValueAnimator valueAnimator = ValueAnimator.ofFloat(0, radius); valueAnimator.setDuration(PULSE_DURATION); valueAnimator.addUpdateListener(updateListener); valueAnimator.setRepeatCount(ValueAnimator.INFINITE); valueAnimator.setRepeatMode(ValueAnimator.RESTART); valueAnimator.start(); return valueAnimator; } 
0
source share

For this use case, itโ€™s best to write your own position indicator.

Three things to do: 1: Register for PositioningManager callbacks that pass the updated position to your code. 2: Create MapMarker with your desired image and add it to the map. 4: Create a MapCircle with the desired color and add it to the map. The radius of the circle must be set to the accuracy parameter of the position manager callback.

The logic for this is to update the MapCircle radius, as well as update the GeoCoordinate of both MapMarker and MapCircle whenever a new position is received from the PositioningManager.

You can be fantastic and add animations using timers and such as to spice up any changes in accuracy.

0
source share
 /* create a MarkerOptions */ MarkerOptions mOptions = new MarkerOptions(); /* create a MarkerInfoAdapter */ MarkerInfoAdapter infoAdapter = new MarkerInfoAdapter(MapsActivity.this.getLayoutInflater()); /* set MarkerInfoAdapter into your Map object */ MapFragment googleMap = FragmentManager.FindFragmentById<MapFragment> (Resource.Id.map); /* get the GoogleMap object */ GoogleMap myMap = googleMap.getMapAsync(this); /* set myMap type */ myMap.setMapType(GoogleMap.MAP_TYPE_NORMAL); /* set the MarkerInfoAdapter */ myMap.clear(); /* myMap.setInfoWindowAdapter(infoAdapter); /* you must have your current location LatLng */ mOptions.position(currentLatLng); /* reach the position of the LatLng for that mark */ /* set the icon for your current location using BitmapDescriptorFactory */ mOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE)); myMap.addMarker(mOptions); /* modify your marker icon to HUE_BLUE */ mOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE)); 
0
source share

I had the same problem as you, and after two weeks try all the options, these lines of code worked for me so you can show the โ€œblue iconโ€

 m_map.setCenter(new GeoCoordinate(latitudeGPS, longitudeGPS, 0.0),Map.Animation.NONE); m_mapFragment.getPositionIndicator().setVisible(true); m_map.getPositionIndicator().setAccuracyIndicatorVisible(true); Log.d("initialize bolita", "" + 1.1 ); PositioningManager.getInstance().start(PositioningManager.LocationMethod.GPS_NETWORK);m_map.addMapObject(m_positionIndicatorFixed); 

Make sure you request all manifest permissions.

0
source share

You can control the icon of the current location of HERE Maps through the com.here.android.mpa.mapping.PositionIndicator class.

Its instance is stored in com.here.android.mpa.mapping.MapView which can be enclosed in a fragment, for example com.here.android.mpa.mapping.SupportMapFragment .

Examples:

 mapFragment.getPositionIndicator().setVisible(true) mapView.getPositionIndicator().setAccuracyIndicatorVisible(true) 
0
source share

All Articles