2012-12-27 189 views
1

如何判斷用戶是否第一次使用我的Facebook應用程序。我想爲用戶做一些初始化,但只是第一次。第一次使用Facebook應用程序

+0

一個簡單的辦法是我店誰使用的用戶列表我的應用程序和每當有人使用我的應用程序,我檢查他們是否列出。有沒有更好的辦法? – Goaler444

回答

1

我不能更好地找到任何東西,所以我做了什麼,我建議珍貴:我存儲用戶ID的列表(上一個數據庫),並檢查用戶是否以前使用我的應用程序。如果用戶的第一次,我執行所需initialisations,然後他/她添加到列表...

0

如果您有訪問數據庫存儲變量的權限。創建一個名爲uservisitsount的變量應該很容易。

然後,您只需在用戶登錄應用程序時計算一次該變量。 uservisitsount ++;

那麼你可以有一段代碼。 如果(uservisitsount == 0){ 做一些事情在第一時間}

問候洗禮

0
FB.getLoginStatus(function(response) { 
    if (response.status === 'connected') { 
    // the user is logged in and has authenticated your 
    // app, and response.authResponse supplies 
    // the user's ID, a valid access token, a signed 
    // request, and the time the access token 
    // and signed request each expire 
    var uid = response.authResponse.userID; 
    var accessToken = response.authResponse.accessToken; 
    } else if (response.status === 'not_authorized') { 
    // the user is logged in to Facebook, 
    // but has not authenticated your app 
    } else { 
    // the user isn't logged in to Facebook. 
    } 
}); 

https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus

相關問題