2

I've developed an android application, and I successfully integrated facebook sdk in my APP.
I made some tests before on HelloFacebookSample application that comes with facebook sdk.
The Application ID given in the UserGraph instance in the HelloFacebookSample have worked well in the graph api.
like this https://graph.facebook.com/1531414210465350
or like this https://www.facebook.com/1531414210465350
knowing that 1531414210465350 is the application ID gotten by user.getId(); in the HelloFacebookSample
But when I tried to put my own application ID in the graph or in the link, I get error:

{
   "error": {
      "message": "Unsupported get request. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
      "type": "GraphMethodException",
      "code": 100
   }
}

I'm missing something but I don't know where, please if you have any suggestion I'll be thankful
This is the main activity code:

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");
        }
    }
}

knowing that I placed my application ID in the manifest and everything is working right except for the scoped application ID is not mapped with the logged profile.

Tarek
  • 1,904
  • 2
  • 18
  • 36
  • 1. You are confusing application id and user id. 2. With API v2, your app does not get the global user id any more, but only an app-scoped user id, that is specific to your app and can only be used by your app to request details about the user. Please go read the changelogs, it is all explained in there. – CBroe Jan 25 '15 at 02:58
  • Ok, but can I get the link property for example ? – Tarek Jan 25 '15 at 10:13
  • If you request user details via the app-scoped user id, you will get a `link` property that redirects to their profile. – CBroe Jan 25 '15 at 14:51
  • I'm pretty sure that the thing I'm having trouble with, so kindly read the question again. – Tarek Jan 25 '15 at 21:03
  • Again: Read the changelog about app-scoped user ids. You can only use an app-scoped user id that you gotten _for_ your app to request your user details _with_ your app. App-scoped user ids for other apps, or the global id, will not work any more for your app with API v2. – CBroe Jan 25 '15 at 21:27
  • Use `/me` to request the user details of the logged-in user. The id you get from there is your app-scoped user id, and that is the id you have to use whenever your app wants to request anything about that user (in contexts where `/me` is not applicable). – CBroe Jan 25 '15 at 22:04

0 Answers0