1、Google Map
特点:
- gps坐标系,最稳定,卫星地图精细
- 在中国服务被Q
- 手机必须要有Google Service Framework
- 在中国不FQ不Root不可用
权限:
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
代码:
LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
return;
}
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, new LocationListener() {
@Override
public void onLocationChanged(Location location) {
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
}
@Override
public void onProviderEnabled(String provider) {
}
@Override
public void onProviderDisabled(String provider) {
}
});
2、百度Map和高度Map
- 百度坐标系,卫星地图不精细(很多户外区域放大没有卫星数据)
- 支持全球定位,功能迭代较快,地图数据加载很快
- 高德稳定性不错,支持全球定位,卫星地图不精细(很多户外区域放大没有卫星数据)
- 百度和高德等国内地图都一般只有中国的数据,高德有海外版,但是要收费
- “火星坐标”系统
两种地图使用流程:
- 申请密钥
- 根据官方文档集成代码