问题
I am developing an application that should present the user near restaurants. For this purpose I want to use Google Places to get the locations and names in order to draw the places on map, using Google Maps. I am confused about the API Keys. I first generated one API key for Google Maps API (android key) and Google Maps works fine with it, but when I try to use Google Places API Web Service with the same key it tells me :
error_message: This IP, site or mobile application is not authorized to use this API key. ... REQUEST_DENIED
Then, I searched and learned that I should generate server key, not android key. I made server key, and there was an option to enter IP address. It said that was optional, so, at first, I didn't enter any IP address, but I got the same mistake above. Then, I put my device's IP address and it worked good last night. Today, I got the same mistake. I am assuming that it's because the IP address changed. Now, the question is : Am I working with the right API key ? How can I fix this ?
I fixed! The problem Google Places API Web Service instead of Google Places API Android. When I enabled this API, it started working with android api key.
来源:https://stackoverflow.com/questions/34521700/how-to-access-google-places-web-service-from-android-application