Saturday 3 January 2015

Android - Draw route map between two geopoints

Download Google Play Services:
               Open EclipseWindowsAndroid SDK Manager and check whether you have already downloaded Google Play Services or not under Extras section. If not select play services and install the package.

Importing Google Play Services into Eclipse:

            1. In Eclipse goto File ⇒ Import ⇒ Android ⇒ Existing Android Code Into Workspace
2. Click on Browse and select Google Play Services project from your android sdk folder. You can locate play services library project from.
android-sdk-windows\extras\google\google_play_services\libproject\google-play-services_lib
3. Importantly while importing check Copy projects into workspace option (By default UnChecked).

Getting Google Map API Key:
          1. In eclipse goto WindowPreferencesExpand Android optionBuildcopy SHA1 fingerprint.
2. Now open Google API Console
3. Select Services on left side and turn on Google Maps Android API v2 & its Related APIs
4. Now select API Access on left side and on the right side click on Create new Android key
5. It will popup a window asking the SHA1 and package name. Enter your SHA1 and your android project package name separated by semicolon ; and click on create
6. Now new API key created.

Creating Project In Eclipse:


                        1. Download the app from here  Click Here


2. Import the Project into Eclipse by going to FileImportExpand AndroidSelect Existing Android code Into workspaceClick Next⇒Select Projectcheck Copy projects into workspace option (By default UnChecked)Click Finish.
3 Now we need to use Google Play Services project as a library to use project. So right click on project and select properties. In the properties window on left side select Android. On the right you can see Add button under library section. Click it and select google play services . Now Google Play Services added to our project. 
4. In this Project I have done t he following changes:

              i.   Add Permission to manifest file
              ii.  Put map key in manifest file
              iii. Updating Java and Xml File



OutPut:





1 comment:

  1. Need help regarding google maps.
    I am trying to show a directional route between the two marker points.
    But i can see a straight line between the marker points on my map instead of a directional route.
    Please help me solve this issue.
    Awaiting your reply.

    ReplyDelete