辅助功能会提供开发者比较常用的实现,辅助功能通过TencentLocationUtils工具类对外暴露。
//两个点之间的距离
double distanceBetween(TencentLocation aLoc, TencentLocation bLoc)
//两个点以经纬度的形式计算距离
double distanceBetween(double aLatitude, double aLongitude, double bLatitude, double bLongitude)
boolean contains(TencentLocation center, double radius, TencentLocation aPoint)
boolean isFromGps(TencentLocation location)
boolean isFromNetwork(TencentLocation location)
boolean isSupportGps(Context context)
以上方法怎么把获取的经纬度按转化为TencentLocation 呢?
//实现TencentLocation 设置对应经纬度
public class MyLocation implements TencentLocation {
private double mLatitude;
private double mLongitude;
public MyLocation(double latitude, double longitude) {
mLatitude = latitude;
mLongitude = longitude;
}
@Override
public double getLatitude() {
return mLatitude;
}
@Override
public double getLongitude() {
return mLongitude;
}
}
有帮助
没帮助