how to access google places web service from android application?

∥☆過路亽.° 提交于 2020-01-03 19:01:34

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!