2012-12-27 193 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

相关问题