简体   繁体   English

使用原生 Android 谷歌地图 API 比集成地图 Javascript ZDB97423871483A14F7 有什么好处?

[英]What are the benefits of using the native Android Google Maps API over integrating Maps Javascript API V3?

I want to develop an Android app that uses google maps heavily.我想开发一个大量使用谷歌地图的 Android 应用程序。 So far I started developing with the native google maps API: http://code.google.com/android/add-ons/google-apis/maps-overview.html but it is quite limited and most of the new functions are not usable.到目前为止,我开始使用原生谷歌地图 API 进行开发: http://code.google.com/android/add-ons/google-apis/maps-overview.ZFC35FDC70D5FC69D2698883A822C7A53的新功能非常有限可用。

To use more function I'm thinking about integrating the Javascript API as discriped here: http://code.google.com/apis/maps/articles/android_v3.html#why To use more function I'm thinking about integrating the Javascript API as discriped here: http://code.google.com/apis/maps/articles/android_v3.html#why

Are things like adding and removing markers etc. with this API possible, too?是否也可以使用此 API 添加和删除标记等? Are there any disadvantages of using the Javascript API?使用 Javascript API 有什么缺点吗?

this is a common question, I'm surprised nobody answered it yet.这是一个常见的问题,我很惊讶没有人回答它。

Google Maps API is "optimized" for smartphones.谷歌地图 API 针对智能手机进行了“优化”。 Really, it is very powerful on iOS, much less on Android.确实,它在 iOS 上非常强大,更不用说在 Android 上。 With the native API, you can fully use the interface (ie touch events, pinch to zoom, etc...), but the massive downside of it is that you can have only ONE map instanciated by MapActivity... Therefore, your MapView needs to be attached to a MapActivity... So forget it if you want to use it in a WebView, it just won't work... At least not nicely.使用原生 API,您可以充分使用界面(即触摸事件、捏合缩放等...),但它的巨大缺点是您只能拥有一个由 MapActivity 实例化的 map...因此,您的 MapView需要附加到 MapActivity ......所以如果你想在 WebView 中使用它,就忘了它,它不会工作......至少不是很好。

The JAvascript API v3 now, has been designed for web pages, so it does not provide support for touch events: zomm is performed by buttons for exemple (this is customizable, but yet antique). JAvascript API v3 现在是为 web 页面设计的,因此它不提供对触摸事件的支持:例如,zomm 是由按钮执行的,但还可以自定义(这是可定制的)。 You can add Overlays with both of the APIs, but remenber that the Google Maps native API is REALLY heavy...您可以使用这两个 API 添加叠加层,但请记住 Google 地图原生 API 真的很重......

So, to summerize, if you want a very quick app that doesn't care about touch event (you can catch a touch to add an Overlay, but this is quite unreliable if I recall), then use Javascript API.因此,总结一下,如果您想要一个不关心触摸事件的非常快速的应用程序(您可以通过触摸来添加覆盖,但如果我记得这很不可靠),那么请使用 Javascript API。 if you, on the other hand, try to developp a wide audience app (ie meant to be on the market), I'd recommend the native API, as painfull and limited as it is, because your end-users won't understand.另一方面,如果您尝试开发广泛的受众应用程序(即打算投放市场),我建议您使用本机 API,因为它既痛苦又有限,因为您的最终用户不会理解. Let's face it, Javascript API is ugly, and looks antique !让我们面对现实吧,Javascript API 很丑,而且看起来很古董!

I had the case some weeks ago: I had troubles including MapView in a WebView (not really meant to be used that way...), so I backed to the Javascript API, just for the app to look like the contract says it should.几周前我遇到过这种情况:我遇到了麻烦,包括 WebView 中的 MapView(并不是真的要那样使用......),所以我支持 Javascript API 合同说它应该看起来像, . Well, believe it or not, the client was VERY unhappy of the result...好吧,不管你信不信,客户对结果非常不满意......

Hope I'd help someone, since this post is so old...希望我能帮助别人,因为这篇文章太老了......

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM