0

When I am trying to login to facebook from my native android app, I am able to log in and my session object is also "OPENED". But I am getting the user object as null. And in the response, I am getting the following error :

{HttpStatus: -1, errorCode: -1, errorType: null, errorMessage: java.lang.SecurityException: Permission denied (missing INTERNET permission?)}

Following is the code snippet :

private void onSessionStateChange(final Session session, SessionState state, Exception exception) {
        if (state.isOpened()) {

        Request request = Request.newMeRequest(session, new Request.GraphUserCallback() {

                @Override
                public void onCompleted(GraphUser user, Response response) {
                    // TODO Auto-generated method stub
                    if (session == Session.getActiveSession()) {
                        if (user != null) {
                            String user_ID = user.getId();//user id
                            String profileName = user.getName();//user's profile name
                        }   
                    }  
                }   
            }); 
            Request.executeBatchAsync(request);

        } else if (state.isClosed()) {
            Log.i(TAG, "Logged out...");

        }
    }

Please help.

Roemer
  • 3,566
  • 1
  • 16
  • 32
user2331595
  • 191
  • 2
  • 10

1 Answers1

0

Add the INTERNET permission to your manifest file.

You have to add this line:

<uses-permission android:name="android.permission.INTERNET" /> 

what-permission-do-i-need-to-access-internet-from-an-android-application.

Community
  • 1
  • 1
sjain
  • 23,126
  • 28
  • 107
  • 185
  • Have you read this - http://stackoverflow.com/questions/17360924/securityexception-permission-denied-missing-internet-permission – sjain May 19 '14 at 09:38
  • Also note that you have to put the `android.permission.INTERNET` in the application attributes permission box instead of specifying in the permissions tab (using Eclipse) that your application uses the permission. – sjain May 19 '14 at 09:41