Use Google Maps JavaScript API in a WebView or Map

2019-08-09 06:56发布

问题:

It seems that developing a map app in a Mapview on android is more traditional.
But I feel the other way also sounds very irresistible.

Since I was developing webs before, I feel more familiar to control Google Map API by JavaScript. And thanks to the strong feature of Android about JavaScript interacting with Action, It seems the only reason to hesitate is the performance? Which I have not tested yet.

When considering cross-platform, JavaScript has the advantage again, I can modify my app to fit other platform easily, there are even open-source projects like the PhoneGap to help me do this.

Is any one has done this before can tell me about what I should be care for?
And I don't know if the JavaScript API key works on local webpages?

Very welcome to discus Advantages and disadvantages of the two ways and share your opinions!

回答1:

I have tried both google maps in webview and as a native component. First of all developing for web is easy and fun. It will work in both iphone and android. But android webview performance sucks when you compare to iphone webview. It can be reasonable to use webview in iphone but not in android.

Just look at google maps native app and open google maps from native browser. It lack of performance. Opening time is slow when compared to native version. And you should zoom out and in just by using buttons. As gestures to zoom in and out does not work. This is the main problem I think as users use native app and wants to use gestures. I did not satisfied from webview component at last I switched to native version.

To sum up, If you do not have too much time and want that your app works for both android and iphone, then use webview. But if performance is important and you have time to develop, then use native version. Just go and try both on your phone.