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.
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
I've had this problem, just ensure that you have enabled the directions api. You need both the sdk for android/ios and the directions api enabled to get it to work.
Related
So I am trying to create a route planner that has google maps but I want to have google maps working in android studio and allow the user to input their source location and their destination location and click display track and it will show the user the routes to them any idea how I can do this?
You can integrate Google Maps into your Android Studio project and display the route between two locations using the Google Maps Directions API. You'll need to obtain an API key from the Google Cloud Console and include it in your project.
You can then make HTTP requests to the API to retrieve the route information and display it on the map.
To find the API documentation and tutorials on how to integrate Google Maps into Android Studio at
https://developers.google.com/maps/documentation/directions/start.
I'm creating polyline route with using google directions API, I'm also trying to animate the route line with using MapAnimator from this link
https://github.com/tintinscorpion/Dual-color-Polyline-Animation/blob/master/uberpolylineanimation/src/main/java/com/logicbeanzs/uberpolylineanimation/MapAnimator.java
this looks nice when i debug the app , it animates well, but creatong release apk , no animation and no route line shown totaly
I had the same issue, the only issue was i was using a key for which directions api was not enabled. I solved it by changing api key with followings enables/added.
Billing enabled
Maps SDk for android (to show map)
Directions API (get polyline/routes data)
Places API (if you are using places search or similar)
Release Signing SHA-1 fingerprint (if key is restricted)
Path for file (app\src\release\res\values\google_maps_api.xml).
I've implemented Google Maps v2 on my emulator, it works fine and displays but I need to test this on an android phone however the map just displays with a blank white screen with zoom buttons. I'm using the debug API key, i don't want to generate a release key just yet, can I still test my maps on a real phone with a debug API key?
If not where can I find the *.keystroke file required to enable me to generate a release key?
I don't have the whole answer but I know you can get the api key on this website :
Visit the APIs Console at https://code.google.com/apis/console and log in with your Google Account.
Click the api&auth link from the left-hand menu.
Activate the Google Maps API v2 service.
Click the credential link from the left-hand menu.
You'll then find on the right panel the API key
Based on your comment that you compile the app then copy it over I believe this might be the answer.
First remove the app from the phone.
Next plug the phone into the computer via the USB cable (make sure the computer recognizes the phone)
(assuming you are using eclipse)
right click on the project, select run as android application.
From the list select your device, and it should upload the app to your phone using the debugging key with out the need of a production key for the map api
If Map Working on Emulator then it should be work on real Device . There should be no problem with console. Just check for Google Play Service. I think in map white screen with grids are shown. If map shows on Emulator using debug key then it also shows on real Device.
I go to File > New > New Android Application and enter the following:
then I click Next and tells me that I can't "Create Activity" and then again in the "New Android Application" and enter the following:
it works and I can check "Create Activity"!
I making a simple thing in pages, text and I want to get map to some place using latitude and longitude through GPS,
My question is, will people who got Android version 2.2 mobile or higher can view everything?
Yes you should use read the Google Maps API doc, you can support 2.2 and above using Google Play Services SDK.
please check :
Google Maps Android - API V2 Documentation
How to setup Google Play Services SDK
Background:
I've inherited someone else's problem and am trying to get an app up and running. Multiple developers have ditched the project and now its my turn. I'm an iOS developer by trade but I have a few simple android project completed.
The problem app is a native android originally built with API level 7 and is heavily built around google maps api version 1. I don't have access to the original keys so I appear to be forced into upgrading to google maps version 2.
I have already set up a new Activity and am beyond the basic tutorials of getting a functioning map. No problems there, but I'm blocked on items like GeoPoint and don't seem to be able to find much information on its replacement.
My question is this:
Is there a migration path to move from API version 1 to API version 2 or do I have to re-code the whole map component? GeoPoints, custom pins, and overlays included?
The sad answer is that most of the objects of Google Map API V1 are replaced with new Objects in Google Map API V2.
For example instead of using GeoPoints you are going to use Latlng points. Overlays are gone as well and replaced with Polylines and Polygones.
Take a look at this answer I gave here:
Convert Android App that uses maps API V1 to Maps Android API V2
And have a look at this blog post I wrote that will get you started with Google Map API V2 implementation in your app:
Google Map API V2
So as you can understand most of the code should be rewritten to fit Google Map API V2.