Google Maps Android API v2 in China - map load took around an hour
Asked Answered
L

2

14

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:

  • Google is not really friendly there, but our app is not the one that is used a google maps in China, so my problem probably is not a new one.
  • There is the option to use a google maps hosted locally in China - ditu.google.cn, but as soon as we are using the native app there is not an option now to use a web view of map instead of native implementation (we have a lot of customizations)
  • I know, that better do not use HTTPS with Google maps (you can read around this here: Google Maps Geolocation API for China)

The question is:

  • Could we somehow improve the load of map? Could we somehow override the google map source to use a ditu.google.cn?
  • Could we somehow disable HTTPS in Map API?
  • Any other solution around this problem, that can be applied based on google services. Maybe there is some undocumented features?

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!

Lenni answered 23/10, 2014 at 8:57 Comment(0)
J
1

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

Jersey answered 31/10, 2014 at 9:30 Comment(0)
A
0

Google still has no map publishing license in China (at least as my latest info goes) It may well be that in the near future Google's Map services will be blocked.

A lot of Chinese websites, including ours, use Google's JS as well as their Service API's, Among them is Google's geocoding api. in china, baidu (NASDAQ:BIDU) and sogou [the minor search engine, part of sohu (NASDAQ:SOHU)] both provided online maps and also APIs,

baidu’s map api home is http://dev.baidu.com/wiki/map/in...

sogou’s map api home is http://map.sogou.com/api/

actually, in china, as of now, the google maps api are still available now. as from recent chinatech.us news, Google China passed the annual inspection and got more opportunity to get online map business license so, the 3 API are are and available.

Actinotherapy answered 31/10, 2014 at 9:27 Comment(1)
That's interesting news.Ashlaring

© 2022 - 2024 — McMap. All rights reserved.