I recently did some prototyping for a native maps plugin for Android. For iOS/phonegap, you have the mapkit plugin which I was able to get working on phonegap 2.0, with some help from the google group. But for Android, the concensus seems to be that you should use the web version of Google Maps (either the javascript version or the static map images). While that advice works for a subset of users, if you pull out your Android phone and compare the performance between the web version of Google Maps and the native app, you’ll quickly choose the native app.
There are two paths forward for a native map plugin. The main limiting factor is that a native map view is only instantiable by a MapActivity,”because it depends on threads which access the network and filesystem in the background; these threads must be shepherded by the lifecycle management” of the MapActivity.
So, you can either:
- have your app be managed by a MapActivity and embed a Cordova webview in the app. This would probably work well for apps that are really really map heavy, and only have a slight bit of webUI. I’m not sure what value PhoneGap brings to that type of app, though. It also seems pretty complex.
- or have the PhoneGap app transition from DroidGap activity to the MapActivity and then back.
- which activity/technology gets the points to display initially
- which activity/technology gets points as the map is moved around
- testing on a real device (what do you do when you are running an Android device without native Google maps)
- passing full featured events back and forth between PhoneGap and the MapActivity