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.
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 .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.