페이스 북에서 사용자 체크 인을 얻고 Google 어스/맵에 넣으 려하고 있는데 예제를 검색했지만 아무 것도 발견하지 못했습니다 (여기와 Google에서).페이스 북 Javascript SDK 구글 맵/어스에 넣을 사용자 체크 인을 얻으십시오
지금 당장 내 문제는 사용자의 체킨을 얻는 것입니다 (먼저 모든 페이스 북 부분을 별도로 만들고 Google 어스 /지도로 수집합니다). 내 응용 프로그램에 권한을 부여하지 않은 것 같습니다. 모든 권한을 테스트 목적으로 요청했지만 여전히 작동하지 않습니다.
<!DOCTYPE html>
<html xmlns:fb="https://www.facebook.com/2008/fbml">
<head>
<title>New JavaScript SDK</title>
<script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
window.fbAsyncInit = function() {
FB.init({
appId: 'appidhere',
status: true,
cookie: true,
xfbml: true,
oauth: true
});
function updateButton(response) {
var button = document.getElementById('fb-auth');
if (response.authResponse) {
//user is already logged in and connected
var userInfo = document.getElementById('user-info');
FB.api('/me', function(response) {
userInfo.innerHTML = '<img src="https://graph.facebook.com/' + response.id + '/picture">' + response.name;
button.innerHTML = 'Logout';
//checkin_id, author_uid, page_id, app_id, post_id, coords, timestamp, tagged_uids, message
var query = FB.Data.query('SELECT page_id, coords, tagged_uids, message FROM checkin WHERE author_uid= me()', response.id);
query.wait(function(rows) {
document.getElementById('user-checkins').innerHTML =
'Place: ' + rows[0].page_id + "<br />" +
'Latitude/Longetude: ' + rows[0].coords + "<br />" +
'Friends you been with: ' + rows[0].tagged_uids + "<br />" +
'Message: ' + rows[0].message + "<br />";
});
});
button.onclick = function() {
FB.logout(function(response) {
var userInfo = document.getElementById('user-info');
userInfo.innerHTML="";
});
};
} else {
//user is not connected to your app or logged out
button.innerHTML = 'Login';
button.onclick = function() {
FB.login(function(response) {
if (response.authResponse) {
FB.api('/me', function(response) {
var userInfo = document.getElementById('user-info');
userInfo.innerHTML = '<img src="https://graph.facebook.com/' + response.id + '/picture" style="margin-right:5px"/>' + response.name;
});
} else {
//user cancelled login or did not grant authorization
}
}, {
scope:'user_about_me, user_activities, user_birthday, user_checkins, user_education_history, user_events, user_groups, user_hometown, user_interests, user_likes, user_location, user_notes, user_photos, user_questions, user_relationships, user_relationship_details, user_religion_politics, user_status, user_subscriptions, user_videos, user_website, user_work_history, email, friends_about_me, friends_activities, friends_birthday, friends_checkins, friends_education_history, friends_events, friends_groups, friends_hometown, friends_interests, friends_likes, friends_location, friends_notes, friends_photos, friends_questions, friends_relationships, friends_relationship_details, friends_religion_politics, friends_status, friends_subscriptions, friends_videos, friends_website, friends_work_history, read_friendlists, read_insights, read_insights, read_mailbox, read_requests, read_stream, xmpp_login, ads_management, create_event, manage_friendlists, manage_notifications, user_online_presence, friends_online_presence, publish_checkins, publish_stream, rsvp_event, publish_actions, user_actions.music, user_actions.news, user_actions.video, user_games_activity, friends_actions.music, friends_actions.news, friends_actions.video, friends_games_activity'
});
}
}
}
// run once with current status and whenever the status changes
FB.getLoginStatus(updateButton);
FB.Event.subscribe('auth.statusChange', updateButton);
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol
+ '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
});
</script>
</head>
<body>
<div id="fb-root"></div>
<h2>Updated JS SDK example</h2><br />
<div id="user-info"></div>
<div id="user-checkins"></div>
<p><button id="fb-auth">Login</button></p>
</body>
</html>
그것은 사진과 이름,하지만 체크인 정보를 보여줍니다
다음
내가 사용하고 코드입니다. 콘솔 쇼 :Uncaught TypeError: Can not read property 'page_id' of undefined facebook2.html: 31
(anonymous function) facebook2.html: 31
t.__wrapper all.js: 49
(anonymous function) all.js: 127
d all.js: 83
(anonymous function) all.js: 83
w all.js: 18
FB.provide.fire all.js: 83
FB.Class.FB.copy.setProperty all.js: 105
FB.subclass.set all.js: 127
(anonymous function) all.js: 129
w all.js: 18
(anonymous function) all.js: 129
would all.js: 66
q all.js: 63
(anonymous function) all.js: 48
(anonymous function)
다른 것들,
여러 체크인이가 있기 때문에, 내가 그들과 함께 루프를 할 어떻게?
coords는 배열이며 위 배열을 위도/장거리 숫자로 변환하려면 어떻게해야합니까?
page_id는 나에게 이드의 이름을 부여합니다 (물론) 나는 그 장소의 이름을 얻고 싶습니다. 어떻게?
누군가가 나를 도울 수 있으면 감사합니다.
'FB.Data.query' 아주 잠시 지금은 사용되지 않습니다. FB.api를 통해 데이터를 얻기 위해 코드를 다시 작성하는 것이 좋습니다. – CBroe
콘솔에서 얇은 것을 보았지만이 샘플은 페이스 북에 가져 오기 ... http://developers.facebook.com/blog/post/2011/07/21/updated-javascript-sdk-and-oauth-2-0 -roadmap/ 몇 가지 예를 찾기가 쉽지 않습니다 ... –