2

I'm building an app using Google-Directions-Android (https://github.com/jd-alexander/Google-Directions-Android). I'm using the API Key in the same App for maps without problems, but when I try to use the following

  Routing routing = new Routing.Builder()
                .travelMode(AbstractRouting.TravelMode.DRIVING)
                .key(getString(R.string.google_api_key))
                .withListener(this)
                .alternativeRoutes(false)
                .waypoints(new LatLng(mLastLocation.getLatitude(), mLastLocation.getLongitude()), pickupLatLng)
                .build();
        routing.execute();

I get an error “This API project is not authorized to use this API”. In my Google API console I have all the 16 maps API enabled and the only one being requested is the Maps SDK for Android. The API key is completely open and unrestricted. Any hints?

Gabriel
  • 35
  • 4

1 Answers1

0

To use google direction library you will have to use your server key(auto generate for you bu google). You can find the server key inside your console

Try replace this code :

.key(getString(R.string.google_api_key))

With the server key - like this :

.key(getString("your server key"))
Tamir Abutbul
  • 7,301
  • 7
  • 25
  • 53