TomGrill / gdx-facebook

libGDX extension providing cross-platform support for Facebook Graph API.
Apache License 2.0
59 stars 21 forks source link

[HELP] How can I do a share? #23

Closed xirtam-ch closed 8 years ago

xirtam-ch commented 8 years ago

Here is my code. Login: `public static void login(final GDXFacebook gdxFacebook, final XFBListener listener) { Array permissions = new Array(); gdxFacebook.signIn(SignInMode.READ, permissions, new GDXFacebookCallback() { @Override public void onSuccess(SignInResult result) { post(gdxFacebook); listener.onSuccess(); }

        @Override
        public void onError(GDXFacebookError error) {
            // Error handling

            listener.onFailed();
        }

        @Override
        public void onCancel() {
            // When the user cancels the login process
            listener.onFailed();

        }

        @Override
        public void onFail(Throwable t) {
            // When the login fails

            listener.onFailed();
        }
    });
}`

`public static void post(final GDXFacebook gdxFacebook) { GDXFacebookGraphRequest request = new GDXFacebookGraphRequest().setNode("xirtamgame/feed").useCurrentAccessToken(); request.setMethod(Net.HttpMethods.POST); request.putField("link", "https://www.google.com"); request.putField("message", "message");

    gdxFacebook.newGraphRequest(request, new GDXFacebookCallback<JsonResult>() {

        @Override
        public void onSuccess(JsonResult result) {
            // Success
        }

        @Override
        public void onError(GDXFacebookError error) {
            // Error
        }

        @Override
        public void onFail(Throwable t) {
            // Fail
        }

        @Override
        public void onCancel() {
            // Cancel
        }

    });
}`

I got "error":{"message":"(#200) The user hasn't authorized the application to perform this action","type":"OAuthException","code":200

I want only share a link,help plz.

xirtam-ch commented 8 years ago

I found your example,thx.

MohammadAbbasKhan commented 7 years ago

can u provide a link for example