我正在尝试为尝试在自动完成中获取地名的用户创建自动填充textField。
我知道Google Place API需要Android或iOS设备的服务器密钥或浏览器密钥。我现在创建了一个浏览器密钥,当我尝试获取数据时,它在json中显示错误。
[INFO] : "error_message" : "This API project is not authorized to use this API.",
[INFO] : "predictions" : [],
[INFO] : "status" : "REQUEST_DENIED"
我正在使用此网址获得以下结果:
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=Sai&types=geocode&language=en&sensor=true&key=#######{MY BROWSER KEY} #######
我尝试了一切,但这些似乎并不起作用。我已经在 API&下使用了 PLACE API 。 AUTH标签。
答案 0 :(得分:3)
如果你的目的只是使用api进行自动完成,你应该使用 geocode api,它是免费的,不需要密钥。它还为您提供与位置相关的完整数据(包括lat和lang)。
这是样本URl:
http://maps.google.com/maps/api/geocode/json?address=YOUR_ADDRESS_HERE&sensor=true