Google map mise à jour de l'emplacement actuel de chaque seconde

Bonjour stackoferflow utilisateurs.

Je développe une Application android et cette app mettre en œuvre Google Play Service

Je l'ai déjà eu mon emplacement et définir un code pin et aussi un cercle sur mes cartes.

Ce que je veux réaliser est lorsque je passe à un endroit, le cercle va également se déplacer et de mettre ma position en tant que centre emplacement.

Ma question est :

  1. Comment mettre à jour ma position actuelle tous les 2 à 5 seconde et le cercle à ma nouvelle position actuelle

  2. Comment configurer mon cercle de la zone comme une zone où le marqueur de lieu, de sorte que si le lanceur dans la région de mon cercle, il ne sera pas indiqué sur la carte.

Merci

C'est mon code que j'utilise pour les cartes:

    mMap.setMyLocationEnabled(true);
mMap.getUiSettings().setCompassEnabled(true);
mMap.getUiSettings().setMyLocationButtonEnabled(true);
mMap.getUiSettings().setRotateGesturesEnabled(true);
locationManager = (LocationManager)getSystemService(LOCATION_SERVICE);
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this);
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this);
//Creating a criteria object to retrieve provider
Criteria criteria = new Criteria();
//Getting the name of the best provider
String provider = locationManager.getBestProvider(criteria, true);
//Getting Current Location
Location location = locationManager.getLastKnownLocation(provider);
mMap.setInfoWindowAdapter(new InfoWindowAdapter() {
@Override
public View getInfoWindow(Marker arg0) {
return null;
}
@Override
public View getInfoContents(Marker marker) {
View v = getLayoutInflater().inflate(R.layout.marker, null);
TextView title= (TextView) v.findViewById(R.id.title);
TextView info= (TextView) v.findViewById(R.id.info);
title.setText(marker.getTitle().toString());
info.setText(marker.getSnippet().toString());
return v;
}
});
if(location != null){
double latitude = location.getLatitude();
double longitude = location.getLongitude();
myPosition = new LatLng(latitude, longitude);   
CameraUpdate center = CameraUpdateFactory.newLatLngZoom(myPosition, 15);
mMap.moveCamera(center);
mMap.addMarker(new MarkerOptions()
.position(myPosition)
.alpha(0.8f)
.anchor(0.0f, 1.0f)
.icon(BitmapDescriptorFactory.fromResource(R.drawable.blue_pin))
.title("Your position :\n ")
.snippet(latitude + " and " + longitude));
CircleOptions circleOptions = new CircleOptions()
.center(myPosition)   //set center
.radius(rad)   //set radius in meters
.fillColor(0x402092fd)  //default
.strokeColor(Color.LTGRAY)
.strokeWidth(5);
circle = mMap.addCircle(circleOptions);   
CameraPosition cameraPosition = CameraPosition.builder()
.target(myPosition)
.zoom(15)
.bearing(90)
.build();
mMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition),2000, null);
}

Merci =)

stackoverflow.com/questions/12451722/...] [1] [1]: stackoverflow.com/questions/12451722/...
Avez-vous un autre exemple @ask4solutions ? Je ne sais pas comment la mettre en œuvre avec mon code. Je veux dire, je l'ai essayer mais il ne semble pas à travailler et je ne suis pas à l'aide de mapView.

OriginalL'auteur Christ Samuel | 2014-01-28