置换德precated Facebook的code为Android [英] Replacement for deprecated Facebook code for Android
本文介绍了置换德precated Facebook的code为Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道而不去precated code以下code确切的更换。 此外,我想尝试在新的Facebook SDK 3.0。
I want to know the exact replacement for the below code without deprecated code. Moreover, i want to try it in new Facebook SDK 3.0.
Facebook aFacebook = new Facebook("app_id");
if( !aFacebook.isSessionValid() ) {
aFacebook.authorize(this, new String[] { "email" },
new LoginDialogListener());
}
我尝试过很多事情。但是,不能把它完成。
I tried many thing. But, couldn't get it done.
TIA
推荐答案
由于这个问题没有答案,我写的。
Since this question has no answer, I am writing one.
在3.0的Facebook SDK为Android,会话类用于登录。最初,如提到的问题,采用在authorize方法
In 3.0 Facebook SDK for Android, Session class is used to Login. Initially, as mentioned in the question, the authorize method was used.
在code,以作为在问题中提到的code确切的更换:
The code to serve as exact replacement for the code mentioned in question:
Session session = Session.getActiveSession();
if (session == null) {
session = new Session(getApplicationContext());
}
Session.setActiveSession(session);
这篇关于置换德precated Facebook的code为Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文