Home » Android » java – Android Maps API version 1 to version 2 migrations

java – Android Maps API version 1 to version 2 migrations

Posted by: admin June 15, 2020 Leave a comment

Questions:

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?

How to&Answers:

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:

Google Map API V2

So as you can understand most of the code should be rewritten to fit Google Map API V2.