我是 android facebook api 的新手,我想在墙上贴上带有标签的剪切图像,但会话总是返回 false。我已经完成了密钥哈希等的所有步骤。
// start Facebook Login
Session.openActiveSession(this, true, new Session.StatusCallback() {
// callback when session changes state
@Override
public void call(Session session, SessionState state, Exception exception) {
if (session.isOpened()) {
Toast.makeText(getApplicationContext(), "da ho tost ka kana", Toast.LENGTH_LONG).show();
publishStory();
// make request to the /me API
Request.executeMeRequestAsync(session, new Request.GraphUserCallback() {
// callback after Graph API response with user object
@Override
public void onCompleted(GraphUser user, Response response) {
if (user != null) {
publishStory();
Toast.makeText(getApplicationContext(), "Hello " + user.getName() + "!", Toast.LENGTH_SHORT).show();
com.actionbarsherlock.app.ActionBar actionBar = getSupportActionBar();
actionBar.setTitle(user.getFirstName());
}
}
});
}
}
});
这是关于活动结果的
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data);
}
session.isopened(); 总是返回假;