我环顾四周,试图找到这个问题的解决方案,但似乎找不到一个有效的解决方案,我试图有一个用户登录的界面,并将好友请求发送给某个用户。我已经指定了 facebook id。登录有效,但是当我尝试实现好友请求部分时,我看到的只是一个对话框,显示您请求的页面不可用。
public class MainActivity extends Activity implements DialogListener {
Facebook fb;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Set View that should be visible after log-in invisible initially
// To maintain FB Login session
TextView name = (TextView) findViewById(R.id.name);
uiHelper = new UiLifecycleHelper(this, callback);
uiHelper.onCreate(savedInstanceState);
}
// When session is changed, this method is called from callback method
@SuppressWarnings("deprecation")
private void onSessionStateChange(Session session, SessionState state,
Exception exception) {
// When Session is successfully opened (User logged-in)
if (state.isOpened()) {
Log.i(TAG, "Logged in...");
fb = new Facebook("130211324324405");
Bundle parameters = new Bundle();
parameters.putString("id", "100001740420495");
fb.dialog(this, "friends", parameters, this);
// make request to the /me API to get Graph user
Request.newMeRequest(session, new Request.GraphUserCallback() {
}
}