简体   繁体   English

Facebook SDK登录错误

[英]Facebook sdk login error

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". 当我尝试从本机android应用程序登录到facebook时,我能够登录,并且我的会话对象也是“ OPENED”。 But I am getting the user object as null. 但是我将用户对象设置为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?)} {HttpStatus:-1,errorCode:-1,errorType:null,errorMessage:java.lang.SecurityException:权限被拒绝(缺少INTERNET权限?)}

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. 请帮忙。

Add the INTERNET permission to your manifest file. INTERNET权限添加到清单文件中。

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 . 我需要从Android应用程序访问Internet的权限

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM