嗨,我在我的 android 应用程序中使用了 facebook 登录。当我在我的设备中构建和运行它时它工作正常。
现在我将应用程序上传到 playstore 并发布它以进行 beta 测试。但不是facebook登录不起作用。我猜会话没有以某种方式打开。我删除了该应用程序,然后从 Eclipse 重新安装。然后它工作正常。我无法调试,因为我不知道如何调试已签名的发布版本。或者我想这是不可能的。无论如何,您是否遇到过与此类似的问题?有什么解决办法吗?或者如何调试?
我正在使用 Facebook 登录按钮,其余代码如下
private void onSessionStateChange(Session session, SessionState state, Exception exception) {
if (state.isOpened()) {
if(!PreferenceHelper.getString(this, "logged_in_status").equals("YES")){
Log.i("sdf", "Logged in...");
this.progress.setVisibility(View.VISIBLE);
Request.executeMeRequestAsync(session, new Request.GraphUserCallback() {
// callback after Graph API response with user object
@Override
public void onCompleted(GraphUser user, Response response) {
userInfo = user;
userId = user.getId();
user_name = user.getName();
Handler looper = new Handler(Looper.getMainLooper());
looper.post(new Runnable() {
@Override
public void run() {
new DownloadFile().execute("http://graph.facebook.com/"+userId+"/picture?type=large");
}
});
try {
emailText = user.getInnerJSONObject().getString("email");
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Log.w("myConsultant", user.getId() + " " + user.getName() + " " + user.getInnerJSONObject());
}
});
}
else{
this.shareFacebook.setVisibility(View.VISIBLE);
}
} else if (state.isClosed()) {
PreferenceHelper.setString(this, "logged_in_status", "NO");
PreferenceHelper.setString(this, "facebook_user_id", "");
PreferenceHelper.setString(this, "user_id","");
PreferenceHelper.setString(this, "user_name", "");
Intent a = new Intent(this,MainMenuActivity.class);
startActivity(a);
overridePendingTransition (R.anim.right_slide_in, R.anim.left_slide_out);
Log.i("sdf", "Logged out...");
}
}
private Session.StatusCallback callback = new Session.StatusCallback() {
@Override
public void call(Session session, SessionState state, Exception exception) {
onSessionStateChange(session, state, exception);
}
};
谢谢并恭祝安康,