我正在使用facebook登录我的Android应用程序,现在在MYSQL数据库中创建用户我想知道用户首次登录应用程序时..
当我们授权应用使用facebook基本信息时,就像这样。
谢谢:)
编辑:我正在使用Facebook登录按钮(<com.facebook.widget.LoginButton... />
)登录&amp;我在使用
onSessionStateChange(SessionState state, Exception exception){...}
答案 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();
}