When we are setting a Key restriction to NONE for Google Maps Direction Api, It works fine.
But When we set Key restriction to Android apps and provide a proper Package name & SHA-1 certificate - It says Request Declined from Google Api response.
Any known solution to this?
Directions API is a web service. The restrictions that will work with an API keys for web services are IP restrictions.
It is supposed that web services requests are executed on your backend servers. If you need to restrict an API key, the workaround is to create an intermediate server. Your Android application should send requests to the intermediate server, intermediate server should send requests to Google and pass responses back to your app. In this case you can restrict an API key by IP address of your intermediate server.
Have a look at this document:
https://developers.google.com/maps/faq#using-google-maps-apis
Hope this clarifies your doubt.
You will usually have more than one certificate. One for debug and one for release.
Ensure that you add both fingerprints or that the certificate fingerprint you are using matches the one for the buildType you specified
Please try with compile 'com.akexorcist:googledirectionlibrary:1.1.1' flow the doc or try this method And 2nd method Set CameraWithCoordinationBounds for animate Camera: