Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
185 views
in Technique[技术] by (71.8m points)

java - Android Google Maps path between 2 markers

I am trying to run the following example to display route directions between two locations on Google Map.

https://www.wingsquare.com/blog/drawing-driving-route-directions-between-two-locations-using-google-directions-in-google-map-android/

However, I keep getting the following error in Android Studio run tab when I click on the map to create two markers:

DownloadTask : { "error_message" : "This API project is not authorized to use this API.", "routes" : [], "status" : "REQUEST_DENIED"}

Also, a toast message shows "No route found".

I have the following APIs enabled in Google Developers Console:

  • Maps SDK for Android
  • Directions API
  • Distance Matrix API
  • Geocoding API
  • Maps Embed API
  • Maps JavaScript API
  • Places API

However, the error message doesn't seem to have changed between enabling each of the APIs.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Once i face the same problem. Then i check the google account for map sdk. There i found that my account was not added with some payment options. Direction API requires payment method. And finally check that you put correct api key in google_maps_api.xml


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...