我遇到了以编程方式登录的问题,并且在登录后,当我希望用户发布某些内容时,当我检查isOpened()的acdtive会话时,它返回false,因此我无法发出任何请求...
这是登录代码:
public void login()
{
Session session = Session.getActiveSession();
if (session == null)
{
session = new Session.Builder(ResourceManager.getInstance().getMainActivity()).build();
Session.setActiveSession(session);
}
if (!session.isOpened())
{
Session.OpenRequest openRequest = new Session.OpenRequest(ResourceManager.getInstance().getMainActivity());
openRequest.setPermissions(PERMISSIONS);
openRequest.setLoginBehavior(SessionLoginBehavior.SSO_WITH_FALLBACK);
session.openForPublish(openRequest);
}
}
以下是我检查是否可以使用会话的代码:
public void post()
{
Session session = Session.getActiveSession();
if (session != null)
{
// This returns always false, so it never goes in...
if (session.isOpened())
{
postStatus(String pStatus);
}
}
}