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

De openkb
Aller à : Navigation, rechercher

Sommaire

Questions

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:

    • 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!

Answers

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);
    }
  }

  //...

}

http://developer.android.com/reference/com/google/android/gms/maps/GoogleMap.OnCameraChangeListener.html http://developer.android.com/reference/com/google/android/gms/maps/GoogleMap.OnCameraChangeListener.html

https://developers.google.com/maps/documentation/android/tileoverlay https://developers.google.com/maps/documentation/android/tileoverlay

Source

License : cc by-sa 3.0

http://stackoverflow.com/questions/26524554/google-maps-android-api-v2-in-china-map-load-took-around-an-hour

Related

Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Outils