Reputation: 1280
I am using Google places API to get the details of particular restaurant.
Now, I wish to display the image of the restaurant in my android app .
For that, I referred this .
However, the below link which is required to get an error gives me a 500 error and when I use http://
in the link instead of https://
, it gives an image which says you have exceeded the API limit.
I am using Glenter link description hereide to display these images. I dont think there's any issue with the Glide . The url generated does not gives any output.
Below is the code :
String url = mPlaces.getIcon();
String photoreference = mPlaces.getPhotoreference();
String restaurantpic = "http://maps.googleapis.com/maps/api/place/photo?" +
"maxwidth=400" +
"&photoreference=" +photoreference +
"&key="+API_KEY;
Log.d("Loading restaurantpic" , restaurantpic);
Glide
.with(mContext)
.load(restaurantpic)
.centerCrop()
// .placeholder(R.drawable.loading_spinner)
//.crossFade()
.into(mImageViewIcon);
This is an example of restaurantpic URL with https protocol which gives 500 error. The same with HTTP protocol gives below attached image(Which is for quota filled).
Upvotes: 2
Views: 2108
Reputation: 71
In case anyone else is having some trouble with this:
If you are trying to use the Web Service API key on Android it will not work correctly if you are also trying to restrict that API key to only certain Android Apps (by package name/fingerprint)
See here: https://developers.google.com/places/web-service/get-api-key#get_an_api_key Note: The Google Places API Web Service does not work with an Android or iOS restricted API key.
Upvotes: 1
Reputation: 1280
So guys, It was my silly mistake to use "referenece" field from the JSON data instead of "photo-reference" field .
The issue was resolved .
Upvotes: 3