我开发了一个Android应用程序,并成功将facebook sdk集成到我的APP中
我之前在facebook sdk附带的HelloFacebookSample应用程序上做了一些测试
HelloFacebookSample中UserGraph实例中给出的Application ID在图api中运行良好
像这样https://graph.facebook.com/1531414210465350
或像这样https://www.facebook.com/1531414210465350
知道1531414210465350
是HelloFacebookSample中user.getId();
得到的应用程序ID
但是当我试图将我自己的应用程序ID放在图表或链接中时,我收到错误:
{
"error": {
"message": "Unsupported get request. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
"type": "GraphMethodException",
"code": 100
}
}
我遗失了一些东西,但我不知道在哪里,如果你有任何建议我会感激的
这是主要活动代码:
public class getJID extends FragmentActivity {
private static final String PERMISSION = "publish_actions";
private LoginButton loginButton;
private UiLifecycleHelper uiHelper;
private Session.StatusCallback callback = new Session.StatusCallback() {
@Override
public void call(Session session, SessionState state,
Exception exception) {
onSessionStateChange(session, state, exception);
}
};
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Session.getActiveSession().onActivityResult(this, requestCode,
resultCode, data);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.facebook_login);
uiHelper = new UiLifecycleHelper(this, callback);
uiHelper.onCreate(savedInstanceState);
Session session = Session.getActiveSession();
loginButton = (LoginButton) findViewById(R.id.connectWithFbButton);
loginButton
.setUserInfoChangedCallback(new LoginButton.UserInfoChangedCallback() {
@Override
public void onUserInfoFetched(GraphUser user) {
if (user != null) {
try {
System.out
.println("this is from the user object "
+ user.getId());
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
}
});
}
private void onSessionStateChange(Session session, SessionState state,
Exception exception) {
if (state.isOpened()) {
System.out.println("SESSION IS OPPENED");
} else if (state.isClosed()) {
System.out.println("SESSION IS CLOSED");
}
}
}
知道我将我的应用程序ID放在清单中并且一切正常,除了范围的应用程序ID没有与记录的配置文件映射。