Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
91 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.

question from:https://stackoverflow.com/questions/65660825/android-google-maps-path-between-2-markers

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

1 Reply

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...