Android facebook检测首次登录

时间:2012-12-10 17:32:15

标签: android facebook

我正在使用facebook登录我的Android应用程序,现在在MYSQL数据库中创建用户我想知道用户首次登录应用程序时..

当我们授权应用使用facebook基本信息时,就像这样。

谢谢:)

编辑:我正在使用Facebook登录按钮(<com.facebook.widget.LoginButton... />)登录&amp;我在使用

进行状态更改时获取用户详细信息
onSessionStateChange(SessionState state, Exception exception){...}

1 个答案:

答案 0 :(得分:1)

您需要先存储该应用是否已在名为“Shared Preferences”的内容中运行。您可以使用以下内容

SharedPreferences prefs = this.getPreferences(Context.MODE_PRIVATE);
if(prefs.contains(HAS_BEEN_RUN_FLAG)){
    //check the database for the user info
}
else{            
    //do the facebook authentication
    prefs.edit().putInt(HAS_BEEN_RUN_FLAG, 1).commit();
}
相关问题