Check out example codes for "android get distance between two locations kotlin". It will help you in understanding the concepts better.

Code Example 1

Location startPoint=new Location("locationA");
startPoint.setLatitude(17.372102);
startPoint.setLongitude(78.484196);

Location endPoint=new Location("locationA");
endPoint.setLatitude(17.375775);
endPoint.setLongitude(78.469218);

double distance=startPoint.distanceTo(endPoint);

Learn ReactJs, React Native from akashmittal.com