开发 Location SDK for Android Guides Geofencing Location Availability Check

Location Availability Check 最后更新时间: 2026年07月02日

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);

返回顶部 示例中心 常见问题 智能客服 公众号
二维码