Question

I have a problem that i get two permissions pop up boxes for my app. First one is "Explovia would like to access your public profile and friend list" and second one is "Explovia would like to access your public profile and friend list, email".

How to set these two to just one? Because second one basicly is asking for same permission as first one + email, is the first permission then realy neccesary ?

// Create session and make Request object with all permisssions listed
Session s = new Session(mActivity);
Session.OpenRequest request = new Session.OpenRequest(mActivity);
request.setPermissions(Arrays.asList("email"));
request.setCallback(mCallback);
s.openForRead(request);

EDIT: added callback code

private Session.StatusCallback mCallback = new Session.StatusCallback() {

    @SuppressWarnings("deprecation")
    @Override
    public void call(Session session, SessionState state,
            Exception exception) {

            if (session.isOpened()) {

              // make request to the /me API

              Request.executeMeRequestAsync(session, new Request.GraphUserCallback() {

                // callback after Graph API response with user object                    
                @Override
                public void onCompleted(GraphUser user,
                        com.facebook.Response response) {

                    try {

                        editEmail.setText((String) user.getProperty("email").toString());
                    }catch(Exception e){

                        Toast.makeText(mActivity,"We couldn't retrieve your email because you didn't confirm your email!",Toast.LENGTH_LONG).show();
                    }

                    editName.setText(user.getFirstName());
                    editSurname.setText(user.getLastName());

                    // We must have try-catch here because if user doesn't have confirmed email, app will crash


                    // Get user id because we will need it later to access 
                    // user profile picture(graph.facebook.com/uId/picture?width=x&height=x)
                    uId = user.getId().toString();
                    String url = "https://graph.facebook.com/"+uId+"/picture?width=200&height=200";


                    imagePhoto.setTag(url);

                    new DownloadImagesTask().execute(imagePhoto);


                    // Delete created session because we don't need it anymore
                    Session.getActiveSession().closeAndClearTokenInformation();
                    Session.setActiveSession(null);


                }
              });
            }

        }

    };
Was it helpful?

Solution

Ok i think i found the solution, in Session.openActiveSession(Activity,Boolean,Status.CallBack), i put false in Boolean parameter and now it works.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top