由于最近在做一个农业化管理App,农场管理员需要查看农场作物的情况,需要十分准确的地图,由此不得不使用Goole的地图(佩服Goole的强大)。不废话,直接上干货。
private void ini() {
final String url = "http://mt0.google.cn/vt/lyrs=y@198&hl=zh-CN&gl=cn&src=app&x=%d&y=%d&z=%d&s=";
TileProvider tileProvider = new UrlTileProvider(256, 256) {
public URL getTileUrl(int x, int y, int zoom) {
try {
return new URL(String.format(url, x, y, zoom));
} catch (MalformedURLException e) {
}
return null;
}
}; LogUtils.e("tileProvider: " + tileProvider);
if (tileProvider != null) {
tileOverlay = aMap.addTileOverlay(new TileOverlayOptions().tileProvider(tileProvider).diskCacheEnabled(true).diskCacheDir("/storage/emulated/0/amap/cache").diskCacheSize(100000).memoryCacheEnabled(true).memCacheSize(100000));
}
}