Document Location SDK for Android Guides Geofencing Location Availability Check

Location Availability Check

Validate Location Availability

Note: Since version 2.2, the parameter order for isAMapDataAvailable(double latitude, double longitude) has been adjusted. The first parameter now accepts latitude, and the second accepts longitude.

Code Sample

CoordinateConverter converter = new CoordinateConverter();

// Returns true if the location is within mainland China, Hong Kong, or Macau; false otherwise.
boolean isAMapDataAvailable = converter.isAMapDataAvailable(latitude, longitude);

// First parameter: latitude, second parameter: longitude.
// Both latitude and longitude must be in the AMap coordinate system.

Calculate Distance Between Two Points

The CoordinateConverter class provides the calculateLineDistance(DPoint startLatlng, DPoint endLatlng) method to calculate the distance between two coordinate points.

Code Sample

calculateLineDistance(DPoint startLatlng, DPoint endLatlng);