简体   繁体   English

具有Titanium的Android的Google Places API自动完成功能

[英]Google Places API Autocomplete for Android With Titanium

I am trying to make an autocomplete textField for user who try to get place name in auto complete. 我正在尝试为试图在自动完成中获取地名的用户创建一个自动完成的textField。

i know that Google Place API needs an Server Key or Browser Key for Android or iOS device. 我知道Google Place API需要Android或iOS设备的服务器密钥或浏览器密钥。 i have created a Browser Key now when i am trying get Data it shows me error in json. 我现在尝试获取数据时创建了一个浏览器密钥,它向我显示json中的错误。

[INFO] :   "error_message" : "This API project is not authorized to use this API.",
[INFO] :   "predictions" : [],
[INFO] :   "status" : "REQUEST_DENIED"

i am using this url to get following Results : 我正在使用此网址获得以下结果:

https://maps.googleapis.com/maps/api/place/autocomplete/json?input=Sai&types=geocode&language=en&sensor=true&key=#######{MY BROWSER KEY} #######

I tried Everything but these seems to doesn't work. 我尝试了一切,但是这些似乎不起作用。 i have Turned on Use PLACE API under API & AUTH Tab . 我已在“ API和身份验证”选项卡下打开“使用PLACE API ”。

If your purpose is only to use the api for autocomplete, you should use the geocode api, its free and does not require key. 如果您的目的只是使用api进行自动完成,则应使用地理编码api,它是免费的,不需要密钥。 Also it gives you complete data related to the location(including lat and lang). 此外,它还为您提供与位置相关的完整数据(包括经纬度)。

here is the sample URl : 这是URl示例:

http://maps.google.com/maps/api/geocode/json?address=YOUR_ADDRESS_HERE&sensor=true http://maps.google.com/maps/api/geocode/json?address=YOUR_ADDRESS_HERE&sensor=true

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM