使用谷歌地图和百度地图在相同的应用程序

问题描述:

我不知道是否还有人指出,就在同一个版本中实现谷歌地图V2和百度地图;因为通用汽车按计划在中国行不通?

I'm wondering if there are anyone out that have implemented Google Maps V2 and Baidu Maps in the same version; because GM doesn't work as intended in China?

或者我应该拆分项目分成两个分支呢?但是这将是很好跳过有两个分支保持。

Or should I split the project into two branches instead? However it would be nice to skip having two branches to maintain.

BR

Henric

我对这个解决方案是实现通用汽车像往常一样,但是如果用户有中国集(通过设置)的静态映射被使用,但在静态地图从百度,而不是谷歌获取。

My solution for this was to implement GM as usual, however if the user has China set (via settings) static maps is to be used, BUT the static map is fetched from Baidu instead of google.

staticUrl = "http://api.map.baidu.com/staticimage?center=" 
                + location.getLongitude() + "," + location.getLatitude() 
                + "&width=" + width + "&height=" + width + "&zoom=15"
                + "&markers=" + location.getLongitude() + "," + location.getLatitude();

中的http://api.map.baidu.com/staticimage?center=121,31&width=300&height=300&zoom=15:

此方法不建议,如果想实现真正的地图解决方案。 因为我只有用不同的国家不同的位置,可以使用此解决方案。

This method is NOT recommended if trying to implement a real map solution. Since I have different locations only used by different countries, this solution could be used.

所以,这就是我如何解决它。希望有人认为这很有帮助。

So, that is how I solved it. Hope someone finds this helpful.