在checkin之前如何获取place_id? [英] How to get place_id before checkin?
问题描述
我的应用程序让用户使用纬度,离子和地名登录到Facebook。但是我不知道如何处理place参数。
有没有办法获取或创建一个?
每个可检入的地方必须有一个有效的Place Facebook页面。
code> place 参数在Place Facebook页面的 page_id
中。
例如,Facebook Facebook的 page_id
104999729569954 http://www.facebook.com/pages/Nanyang-Polytechnic/104999729569954
如果您的应用程序允许用户根据当前位置进行签到
1)使用外部地图服务(如Google Map的Geolocation)来获取用户当前位置的坐标(lat& lon)。
从Google Map返回的坐标系与Facebook自己的坐标系不同。
2)为了克服这个问题,做一个FQL查询找到Facebook坐标与Google Map坐标最接近的匹配。
SELECT page_id,纬度,经度FROM place WHERE distance(纬度,经度, LAT_HERE,LON_HERE)< 250
250
是指它将搜索的半径(m)可以到 50000
。
3)现在你有 page_id
,
纬度
和经度
。将 page_id
分配到位置
参数中。将纬度
和经度
分配到坐标
参数中。然后,您可以发布签到。
您可以参考我在此发布的发布签到示例。 Facebook - 使用PHP SDK / JavaScript SDK发布签名
如果您的应用程序允许您的用户根据地名列表中的选择进行签到或图片库(在游戏中或某些东西)
您只需要找到 page_id
,并将它们绑定到相应的地名或图片。
文档 / p>
My app lets users checkin with lat, lon and place name to Facebook. But I don't know how to deal with "place" parameter.
Is there any way to get or create one?
Each checkinable place must have a valid Place Facebook Page.
The place
parameter takes in the page_id
of a Place Facebook Page.
For example, page_id
104999729569954 of Place Facebook Page http://www.facebook.com/pages/Nanyang-Polytechnic/104999729569954
If your application is letting your users to checkin based on their current location
1) Use an external map service such as Google Map's Geolocation to get the coordinates(lat & lon) of your user's current location.
The set of coordinates returned from Google Map is different from Facebook's own set of coordinates.
2) To overcome this, do a FQL query to find the closest match of Facebook's coordinates with Google Map's coordinates.
SELECT page_id,latitude,longitude FROM place WHERE distance(latitude, longitude, "LAT_HERE", "LON_HERE") < 250
250
refers to the radius(m) that it will search within, it can go up to 50000
.
3) Now that you have page_id
, latitude
and longitude
. Assign page_id
into place
parameter. Assign latitude
and longitude
into coordinates
parameter. You will then be able to publish checkin.
You can refer to publish checkin examples that I have posted over here. Facebook - Publish Checkins using PHP SDK/JavaScript SDK
If your application is letting your users to checkin based on selection from a list of place names or gallery of images (in a game or something)
You will just need to find the page_id
of each place and bind them to respective place name or image.
Documentation
Page FQL - http://developers.facebook.com/docs/reference/fql/page/
Checkins API - http://developers.facebook.com/docs/reference/api/user/#checkins
这篇关于在checkin之前如何获取place_id?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!