title: Android Google Map how to check if user is in marker circle region
body: <p>I am using Google Maps, and want to be able to detect if a user is in the radius of a Marker (placed on map), using the users current location. I have the users current location coordinates (latitude and longitude) and the marker's coordinates, but do not know how to calculate whether the user is in the area. The picture below might best describe what I want to do.</p>
  
  <p><img src="https://i.stack.imgur.com/LDujf.png" alt="enter image description here"></p>
  
  <p>I have an algorithm like this: </p>
  
  <pre><code>map.OnInfoWindowClickListener(new OnInfoWindowClickListener()){
      public void isUserInArea(Marker marker){
  
          float[] distance = new float[2];
             //users current location 
          Location.distanceBetween(currentLocation.getLatitude(),currentLocatiocation.getLongitude(),
          marker.getPosition().latitude, marker.getPosition().longitude, distance);
  }
  </code></pre>
  
  <p>Which doesn't find if the current location is within marker region because I can't get hold of the markers circle. It's the closest i've got to it however. Would appreciate help.</p>
  
  <p>To help, I add a circle to a map like this</p>
  
  <pre><code>// adding circle to map
  circleOptions = new CircleOptions();
  circleOptions.center(new LatLng(locationlist.get(i)
          .getLatitude(), locationlist.get(i).getLongitude()));
  circleOptions.radius(20);
  circleOptions.strokeColor(Color.BLUE);
  circleOptions.fillColor(Color.BLUE);
  map.addCircle(circleOptions);
  
  //check that all tasks are in circle radius
  
  Marker locationMarker = map.addMarker(markerOp);
  locationMarker.showInfoWindow();
  </code></pre>