Skip to content

Instantly share code, notes, and snippets.

@rogergcc
Created January 13, 2021 17:45
Show Gist options
  • Save rogergcc/82bbfc5b1073adfc18f8728b2976b5de to your computer and use it in GitHub Desktop.
Save rogergcc/82bbfc5b1073adfc18f8728b2976b5de to your computer and use it in GitHub Desktop.
private ArrayList<LocationModel> locationModels = new ArrayList<>();
geofenceList.add(new Geofence.Builder()
// Set the request ID of the geofence. This is a string to identify this
// geofence.
.setRequestId(locationModel.getLat() + locationModel.getLon())
.setCircularRegion(
Double.parseDouble(locationModel.getLat()),
Double.parseDouble(locationModel.getLon()),
(float) Double.parseDouble(String.valueOf(documentSnapshot.getData().get("radius")))
)
.setTransitionTypes(Geofence.GEOFENCE_TRANSITION_ENTER)
.setExpirationDuration(Geofence.NEVER_EXPIRE)
.setNotificationResponsiveness(1000)
.build());
circle = mMap.addCircle(new CircleOptions()
.center(new LatLng(Double.parseDouble(locationModel.getLat())
, Double.parseDouble(locationModel.getLon())))
.radius(Double.parseDouble(String.valueOf(documentSnapshot.getData().get("radius"))))
// .strokeColor(getResources().getColor(R.color.lignt_primary))
.strokeColor(ContextCompat.getColor(this, R.color.circle_strok))
.strokeWidth(4.f)
// .fillColor(getResources().getColor(R.color.lignt_primary)));
.fillColor(ContextCompat.getColor(this, R.color.circle_fill)));
locationModels.add(locationModel);
@rogergcc
Copy link
Author

private ArrayList<LocationModel> locationModels = new ArrayList<>();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment