我已经搜索过这个主题,在 StackOverflow 上发现了一些类似的问题,但不幸的是它们都没有帮助。
这是我使用我的应用程序对 facebook 进行登录身份验证的代码。但我每次都收到一个空响应。
public class FacebookHome extends Activity{
@Override
public void onCreate(Bundle iCicle){
super.onCreate(iCicle);
setContentView(R.layout.activity_facebookhome);
// 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()) {
// 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) {
Log.e("PanicButton",response.toString());
if (user != null) {
TextView welcome = (TextView) findViewById(R.id.textView1);
Log.i("PanicButton", user.getFirstName());
welcome.setText("Hello " + user.getFirstName() + "!");
}
}
});
}
}
});
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data);
}
}