What I have: native android app that use Android Maps API v2 (native library)
Everything works good in Hong Kong and Ukraine. The problems came as soon as we step in China border. We have next problems:
What I know around China:
The question is:
What is did not expect as an answer is something like "Use Baidu". I know Baidu and this is a veeerryyy backup option as soon as they have an api docs in chineese.
It's fare to add, that Geocoding API based on ditu.google.cn works good.
Looking forward, thank you!
From Google website: The Google Maps APIs are served within China from http://maps.google.cn. When serving content to China, replace https://maps.googleapis.com with http://maps.google.cn.
Like all popular Google services, Google Maps too is banned in China. The map developed by Baidu search engine is widely considered the most popularly-used map in China.
Maybe you can't override the original tile source. But you can use TileOverlay to get maps tile from external server.
Usage example :
TileProvider tileProvider = new UrlTileProvider(256, 256) {
//...
@Override
public URL getTileUrl(int x, int y, int zoom) {
/* Define the URL pattern for the tile images */
String s = String.format("http://my.image.server/images/%d/%d/%d.png",
zoom, x, y);
if (!checkTileExists(x, y, zoom)) {
return null;
}
try {
return new URL(s);
} catch (MalformedURLException e) {
throw new AssertionError(e);
}
}
//...
}
You can replace the my.image.server
with ditu.google.cn
and use external server API to get tile images. In the Maps, you can set OnCameraChangeListener, so the application will load tiles from external server when the map is zooming or panning.
Read more : https://developers.google.com/maps/documentation/android/tileoverlay
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With