Home Android Facebook native app not getting user email and birthday even with permissions set and correct information in fields
Reply: 0

Android Facebook native app not getting user email and birthday even with permissions set and correct information in fields

user2014
1#
user2014 Published in June 20, 2018, 7:45 am

I'm trying to get the user email and birthday (using a Me request). My app has email and user_birthday permissions and the fb account i'm using has an email and a birthday set.

When I try using the 'Graph API Explorer' (https://developers.facebook.com/tools/explorer) using the user access_token with 'fields=id,email,birthday' all I get is the id.

Can anybody advice me on this please.

Here is my code:

        Session.openActiveSession(this, true, new Session.StatusCallback() {
        // callback when session changes state
        @Override
        public void call(Session session, SessionState state, Exception exception) {
            if (session.isOpened()) {
                // make request to the /me API
                Request request = Request.newMeRequest(session, new Request.GraphUserCallback() {
                    // callback after Graph API response with user object
                    @Override
                    public void onCompleted(GraphUser user, Response response) {
                        if (user != null) {
                            // here I check the infos I got.
                            Log.d("some tag", user.getInnerJSONObject().toString()); // it shows only the id, no email or birthday.

                            if (Session.getActiveSession() != null) {
                                Log.i(TAG, "Log out from FB");
                                Session.getActiveSession().closeAndClearTokenInformation();
                            }
                        }
                    }
                });
                // set params.
                request.getParameters().putString("fields", "id,email,birthday");
                // execute request.
                request.executeAsync();
                Log.d(TAG, request.toString());
            }

            if (exception != null) {
                exception.printStackTrace();
            }
        }
    });

Many thanks.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.362727 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO