Api key request denied - android

I am trying do that drawing path between two location,when I try do this I got a error this.
I shared below my url and error.I created Android api key,wht I got request denied error from google api
url: https://maps.googleapis.com/maps/api/directions/json?origin=41.050399,28.940599&destination=41.1119857,29.0186137&sensor=false&mode=driving&alternatives=true&key=AIzaSyB9LW3JNai1tGYtSVZrRGMGeJ71q7Y3DbA
json:{
"error_message" : "This IP, site or mobile application is not authorized to use this API key. Request received from IP address 78.186.62.169, with empty referer",
"routes" : [],
"status" : "REQUEST_DENIED"
}

I dont think that is the correct way of using it, try something like this
https://maps.googleapis.com/maps/api/js?key=<YOUR_API_KEY>&callback=initMap
and if it is in a variable then u will need " " like
src="https://maps.googleapis.com/maps/api/js?key=<YOUR_API_KEY>&callback=initMap"

Directions API web service requires a Server API key, not Android API key.
Please look at the documentation:
https://developers.google.com/maps/documentation/directions/get-api-key#get-an-api-key

Related

Google places json denial

I am trying to create a sample app using Google Places Api. I have never used this api before,so I want to give it a try:).
The first thing I did was to enable Google Places Api for Android and to create an Android key from Google Console api with the keytool command in cmd(I am using Windows 8.1). Then I add my API_KEY into the following link as..
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&radius=500&types=food&name=cruise&key=AIzaSyC8aJYaI9djrUoEMaMIa3sRF36buKPSV0M
and the json response I am getting is this.
{
"error_message" : "This API project is not authorized to use this API. Please ensure that this API is activated in the APIs Console: Learn more: https://code.google.com/apis/console",
"html_attributions" : [],
"results" : [],
"status" : "REQUEST_DENIED"
}
Why do I have a request denied status?
Thanks

unable to get the routes from the google api

I got the api key by following the usual steps.
Then I was able to get map and use some inbuilt things on it like search etc
Then later I tried routing, I was unable to get the routes. When I pasted the request:
https://maps.googleapis.com/maps/api/directions/json?origin=28.6100,2077.2300&destination=18.9750,72.8258&key=mykey
on the browser I got the following and realized that I don't have the permission. I searched for this problem but couldn't find the solution, please help.
Response on browser:
{
"error_message" : "This IP, site or mobile application is not authorized to use this API key. Request received from IP address xxxxxxxx, with empty referer",
"routes" : [],
"status" : "REQUEST_DENIED"
}
Make sure you are using server API key, not an Android key (mobile development). See this post:
Google Places API request denied for Android autocomplete, even with the right api key .
Also make sure you are sending the key to GooglePlaces instance.
If you are restricting use of API key by IP make sure your request is coming from an allowed address.

Place API for Android

I'm trying to use the Google Places API in my application. For that I need to generate Server Key.
I used my device IP address to generate a Server Key. My app works only in my device. If I use some other device I get an error:
{
"error_message" : "This IP, site or mobile application is not authorized to use this API key.",
"predictions" : [],
"status" : "REQUEST_DENIED"
}
Could you please help me in this regards. How to generate Server key which works for all devices.
Try to create a new Places API key. When creating the key choose the server but leave the IP field blank (so as to allow any IP address).
Notify and vote up if it works.

Google Map API For Near By Place By Latitude and Longitude

I have an Api key, Api console and Sh1, and using EclipseIDE ANDROID -> preference, I
added all data in Api as below:
https://maps.googleapis.com/maps/api/place/radarsearch/json?location=48.859294,2.347589&radius=5000&types=food|cafe&sensor=false&keyword=vegetarian&key=AIzaSyCRQ2aFtbU2sOgO6fMvuM2edHPaWRDxbRg
But I get this error message:
{
"error_message" : "This IP, site or mobile application is not authorized to use this API key.",
"html_attributions" : [],
"results" : [],
"status" : "REQUEST_DENIED"
}
What am I doing wrong?
I request you to Use following API
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=48.859294,2.347589&radius=500&types=school&sensor=false&key=AIzaSyDN1QX-gWUR-mIYo_D21PNFLHHpNQkIkGU
So I had the same issue you were experiencing, I used the same api as you however what I found was that if you generate a new API key for android it does not work, but if you generate a new Server key and use that it works perfectly. I found some assistance on the following post REQUEST_DENIED with Google Places API browser key or app key?

Error with the google map calling direction api from android device

I'm using the Google map v2 for android. I would like to call to the directions api to get the points from android device. I registered the Google console key, I can view the map on android. I used this key to include in the directions api call like this:
https://maps.googleapis.com/maps/api/directions/json?origin=Toronto&destination=Montreal&sensor=false&key=API_KEY
The API_KEY is the key I created for maps:
But when I request from android apps to call to directions api, I got this returned:
{
"error_message" : "This IP, site or mobile application is not authorized to use this API key.",
"routes" : [],
"status" : "REQUEST_DENIED"
}
How can I resolve this error? Please help
Thanks
this is right URL which is call to get direction path between two geo point.
http://maps.googleapis.com/maps/api/directions/json?origin=23%C2%B0%201%27%2050.49711640%22%2C%2072%C2%B0%2034%27%2014.520786762%22&destination=22%C2%B0%2017%27%208.23132830%22%2C%2073%C2%B0%2012%27%2026.766651630%22&sensor=true&mode=driving
there is no need to pass KEY=api-key in Direction URL..
so,please remove this paramter.and call URL As per above..
api key only put in <meta-data> tag in manifest file.
Please call this URL:
https://maps.googleapis.com/maps/api/directions/json?origin=Toronto&destination=Montreal&sensor=false
i hope its useful to you.

Categories

Resources