获取地点的开放时间 - 安卓 [英] Get opening hours of place -Android
问题描述
Setp-1:
我已经得到了如何在android中获取地点的开放时间,我拥有当前位置的经纬度。调用此API的地点ID' http ://maps.googleapis.com/maps/api/geocode/json?latlng = 39.7837304,-100.4458825& sensor = true '
响应这个api返回地址数组,从这个数组获得第一个地址的地址ID。
9-2: -
获取地点ID后,将此地点ID传入此API
' https://maps.googleapis.com/maps/api/place/details/json?placeid= + placeId +& key = API_KEY'
问题: -
以上API不返回opening_hours。
请指导。
感谢
总结
这是因为您实际上并没有在该位置查找商家,你正在查找地址,地址没有开放时间。
详细解释
您正在使用反向地理编码为Latitude /经度,查找地址。地址没有开放时间。在地址上的企业可以做到,但这些地址具有明显的地点ID。
您可以在链接的示例中明白地看到这一点: http://maps.googleapis.com/maps/api/geocode/json?latlng= 39.7837304,-100.4458825 [请注意, 另类 由于您使用的是Android,您可能需要使用 How to get opening hours of the place in android, I have latitude and longitude of the current location. Setp-1:
I have get the place id by calling this API 'http://maps.googleapis.com/maps/api/geocode/json?latlng=39.7837304,-100.4458825&sensor=true' The response of this api return the array of address, from this array will get the first address place ID. Sept-2:- After getting place id pass this place id into this API
'https://maps.googleapis.com/maps/api/place/details/json?placeid="+placeId+"&key=API_KEY' Problem:-
Above API not return opening_hours. Please guide. Thanks Summary This is because you're not actually looking up the business(es) at that location, you're looking up the address, and addresses don't have opening hours. Detailed explanation You're using Reverse Geocoding for a Latitude/Longitude, which looks up an address. Addresses don't have opening hours. Businesses at addresses do, but those are distinct places with distinct Place IDs. You can see this this pretty plainly in the example you link to: http://maps.googleapis.com/maps/api/geocode/json?latlng=39.7837304,-100.4458825 [note that Alternative As you're on Android, you probably want to use 这篇关于获取地点的开放时间 - 安卓的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! sensor
是不推荐使用的参数,您应该省略]。在该响应中,结果的类型
类型为 route ,
administrative_area_level_3
, postal_code
等等,清楚地表明所有没有开放时间的实体。
PlaceDetectionApi.getCurrentPlace()
获取当前位置,而不是反向地理编码请求。这可以返回企业。sensor
is a deprecated parameter, you should omit it]. In that response the types
of the results are types like route
, administrative_area_level_3
, postal_code
, etc, clearly all entities that don't have opening hours.PlaceDetectionApi.getCurrentPlace()
to get the current place, rather than a reverse geocode request. This can return businesses.