1
votes

I am using Parse for facebook login, while I create facebook event its not create and and showing error on response

this is my following code.

private void onLoginButtonClicked() {
    LoginActivity.this.progressDialog = ProgressDialog.show(
            LoginActivity.this, "", "Logging in...", true);
    List<String> permissions = Arrays.asList("basic_info", "user_about_me",
            "user_relationships", "user_birthday", "user_location",
            "read_friendlists", "user_events");
    ParseFacebookUtils.logIn(permissions, this, new LogInCallback() {
        @Override
        public void done(ParseUser user, ParseException err) {
            LoginActivity.this.progressDialog.dismiss();
            if (user == null) {

                Log.d(IntegratingFacebookTutorialApplication.TAG,
                        "Uh oh. The user cancelled the Facebook login.");
            } else if (user.isNew()) {
                Log.d(IntegratingFacebookTutorialApplication.TAG,
                        "User signed up and logged in through Facebook!");
                // showUserDetailsActivity();
                // getFacebookIdInBackground();
                callCreateEvent();
            } else {
                Log.d(IntegratingFacebookTutorialApplication.TAG,
                        "User logged in through Facebook!");
                System.out.println("kkkk cccc" + user.getUsername());
                callCreateEvent();
                // showUserDetailsActivity();
                // getFacebookIdInBackground();

            }

        }
    });

}

private void callCreateEvent() {

    Bundle params = new Bundle();
    params.putString("name", "This is a test event");
    params.putString("start_time", "2014-05-21T18:00:00+0530");
    params.putString("description", "This is test description yeah?.");
    params.putString("privacy_type", "OPEN");

    new Request(ParseFacebookUtils.getSession(), "me/events", params,
            HttpMethod.POST, new Request.Callback() {
                public void onCompleted(Response response) {
                    System.out.println("kkk resonse \n>> " + response);
                }
            }).executeAsync();
}

05-21 17:19:29.180: I/System.out(14773): >>

{Response: responseCode: 400, graphObject: null, error: {HttpStatus: 400, errorCode: 12, errorType: OAuthException, errorMessage: (#12) events management API is deprecated for versions v2.0 and higher}, isFromCache:false}

1

1 Answers

0
votes

I'm also faced same issues for username is deprecated in v2.0 version. Nothing, this is simple. I just removed that from permission list. because this key is not available in graphObject response. so It is showing this error. me/events also deprecated. If you check latest API in facebook developers site. they have mentioned clearly. Instead of events they have given another replacements. please handle that. That ll help you to reach your goal.