0

So I have an application that is currently using the facebook api to get a users info from facebook. The application has been working 100% until today when suddenly, certain info wouldnt load. I traced it back to the Facebook me request foor getting into from the current user. This is the Log of the request:

{Request:  session: {Session state:OPENED, token:{AccessToken token:ACCESS_TOKEN_REMOVED permissions:[user_birthday, basic_info]}, appId:349620835240734}, graphPath: me, graphObject: null, httpMethod: GET, parameters: Bundle[{}]}

The graph object is null and the onCompleted method is never called. As I stated before, this has been working great up until now and I have not touched this class at all. The entire request is below, and any help is GREATLY appreciated!

Request request = Request.newMeRequest(mSession, new  Request.GraphUserCallback() {
                @Override
                public void onCompleted(GraphUser user, Response response) {
                    // If the response is successful
                    if (mSession == Session.getActiveSession()) {
                        if (user != null) {
                            String currentUserId = user.getId();
                            String name = user.getFirstName();
                            String birthday = user.getBirthday();
                            String age = getAge(birthday);
                            String gender = user.asMap().get(Constants.GENDER).toString();

                            mParseUser.put(Constants.NAME, name);
                            mParseUser.put(Constants.AGE, age);
                            mParseUser.put(Constants.GENDER, gender);
                            mParseUser.saveInBackground();

                            SharedPreferences pref =
                                    mContext.getSharedPreferences(ParseUser.getCurrentUser().getUsername(),
                                            Context.MODE_PRIVATE);
                            SharedPreferences.Editor ed = pref.edit();
                            ed.putString(Constants.FACEBOOK_USER_ID, currentUserId);
                            ed.apply();
                        }
                    }
                }
            });
            Request.executeBatchAsync(request);
            Log.e("RequestValue", String.valueOf(request));
Rich Luick
  • 2,354
  • 22
  • 35

1 Answers1

0

Use this library when you deal with Facebook API.because it is AWESOME!! Really!..

https://github.com/sromku/android-simple-facebook

Read the docs and enjoy the library.

Tell me if it helps

theapache64
  • 10,926
  • 9
  • 65
  • 108
  • So accept the answer,though it will help other people to find correct answer. :) – theapache64 Feb 24 '15 at 20:24
  • Well let me implement it first. It certainly looks easier but Im thinking I will still succumb to the same error. Considering my original solution has been working fine for a few weeks Im thinkin somethings weird with the connection. This library def seems way easier though! – Rich Luick Feb 24 '15 at 20:27
  • Alright well it seems to be working well! I was able to get the username. Will reformat my request a little later to get everything else. Im still hoping someone can tell me why my code suddenly stopped working though so Ill wait a day or two before I do anything – Rich Luick Feb 24 '15 at 20:46
  • No Problem.. :) , I wish i could help you but am not familiar with your Faceboook API. – theapache64 Feb 25 '15 at 02:24