I want to develop an Android app that uses google maps heavily. So far I started developing with the native google maps API: http://code.google.com/android/add-ons/google-apis/maps开发者_StackOverflow中文版-overview.html but it is quite limited and most of the new functions are not usable.
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? Are there any disadvantages of using the Javascript API?
this is a common question, I'm surprised nobody answered it yet.
Google Maps API is "optimized" for smartphones. Really, it is very powerful on iOS, much less on Android. With the native API, you can fully use the interface (i.e. 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.
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). You can add Overlays with both of the APIs, but remenber that the Google Maps native API is REALLY heavy...
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. if you, on the other hand, try to developp a wide audience app (i.e. 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. Let's face it, Javascript API is ugly, and looks antique !
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. Well, believe it or not, the client was VERY unhappy of the result...
Hope I'd help someone, since this post is so old...
精彩评论