问题描述
我已经继承了别人的问题,并试图启动并运行应用。多个开发者已经放弃了这个项目,现在轮到我了。我是交易的iOS开发者,但我有一些简单的Android项目完成。这个问题应用程序是一个原生的android,最初是使用API级别7构建的,并且围绕google maps api version 1大量构建。我无权访问原来的钥匙,所以我似乎被迫升级到谷歌地图版本2.
我已经建立了一个新的活动,超出了基本教程得到一个有效的地图。那里没有问题,但我被GeoPoint等项目封锁,似乎无法找到更换它的更多信息。
我的问题是这样的:
是否有迁移路径API版本1到API版本2还是必须重新编码整个地图组件? GeoPoints,自定义引脚和覆盖层包括在内?
可悲的答案是Google Map的大部分对象 API V1
替换为Google Map中的新对象 API V2
。
例如,不是使用 GeoPoints
您将使用 Latlng
点。叠加层也消失了,并被替换为 Polylines
和 Polygones
。
看看我在这里给出的答案:
请看看我写的这篇博客文章,它将帮助您开始在您的应用中使用Google Map API V2实现:
因此,您可以了解大部分代码应该重写为适合Google Map API V2。
Background:
I've inherited someone else's problem and am trying to get an app up and running. Multiple developers have ditched the project and now its my turn. I'm an iOS developer by trade but I have a few simple android project completed.
The problem app is a native android originally built with API level 7 and is heavily built around google maps api version 1. I don't have access to the original keys so I appear to be forced into upgrading to google maps version 2.
I have already set up a new Activity and am beyond the basic tutorials of getting a functioning map. No problems there, but I'm blocked on items like GeoPoint and don't seem to be able to find much information on its replacement.
My question is this:
Is there a migration path to move from API version 1 to API version 2 or do I have to re-code the whole map component? GeoPoints, custom pins, and overlays included?
The sad answer is that most of the objects of Google Map API V1
are replaced with new Objects in Google Map API V2
.
For example instead of using GeoPoints
you are going to use Latlng
points. Overlays are gone as well and replaced with Polylines
and Polygones
.
Take a look at this answer I gave here:
Convert Android App that uses maps API V1 to Maps Android API V2
And have a look at this blog post I wrote that will get you started with Google Map API V2 implementation in your app:
So as you can understand most of the code should be rewritten to fit Google Map API V2.
这篇关于Android Maps API版本1到版本2迁移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!