GithubHelp home page GithubHelp logo

fotopretty / google-directions-android Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jd-alexander/google-directions-android

0.0 2.0 0.0 3.69 MB

This project allows you to calculate the route between two locations and displays it on a map.

Home Page: https://play.google.com/store/apps/details?id=com.directions.sample

License: MIT License

Java 100.00%

google-directions-android's Introduction

Google-Directions-Android

Maven Central Android Arsenal Build Status

This project allows you to calculate the direction between two locations and display the route on a Google Map using the Google Directions API..

Example Image

Sample

The sample makes use of the Google Places API for Android in order to provide a real life example of how the library can be used.You can check it out on the store.

Download

Grab via Maven:

<dependency>
  <groupId>com.github.jd-alexander</groupId>
  <artifactId>library</artifactId>
  <version>1.1.0</version>
</dependency>

or Gradle:

    compile 'com.github.jd-alexander:library:1.1.0'

Usage

To calculate the route you simply instantiate a Routing object and trigger the execute function.

*You can execute the task in this manner. ( See the example for more details on the exact implementation)

        Routing routing = new Routing.Builder()
                    .travelMode(/* Travel Mode */)
                    .withListener(/* Listener that delivers routing results.*/)
                    .waypoints(/*waypoints*/)
                    .key(/*api key for quota management*/)
                    .build();
        routing.execute();
        

actual code

        start = new LatLng(18.015365, -77.499382);
        waypoint= new LatLng(18.01455, -77.499333);
        end = new LatLng(18.012590, -77.500659);
        
        Routing routing = new Routing.Builder()
                    .travelMode(Routing.TravelMode.WALKING)
                    .withListener(this)
                    .waypoints(start, waypoint, end)
                    .build();
        routing.execute();
        
        .....
        
       @Override
    public void onRoutingSuccess(ArrayList<Route> route, int shortestRouteIndex)
    {
       //code to add route to map here. See sample app for more details.
    }

Known Issues

  • If the AutoComplete TextView/Map of the sample app isnt working then probably the API key hasn't been set in the manifest.

  • If the route is not being displayed then type "Routing" in your log cat to see the potential error messages from the library.

Contribution

Please fork repository and contribute using pull requests.

Any contributions, large or small, major features, bug fixes, additional language translations, unit/integration tests are welcomed and appreciated but will be thoroughly reviewed and discussed.

Contributors

License

Copyright 2016 Joel Dean

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

google-directions-android's People

Contributors

jd-alexander avatar fcduarte avatar licryle avatar bilthon avatar ksarmalkar avatar kuwapp avatar bitdeli-chef avatar fgil avatar furkantektas avatar joaopedronardari avatar nevstad avatar yusufiga avatar

Watchers

James Cloos avatar Voravit Euavatanakorn avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.