I am using new Facebook Android Sdk in my Application, I have created App ID in developer page and used the code below
code:
private List<String> PERMISSIONS = Arrays.asList("user_photos","email");
public void loginToFacebook(){
Session.openActiveSession(getParent(), true, new Session.StatusCallback() {
@Override
public void call(final Session session, SessionState state,Exception exception) {
// TODO Auto-generated method stub
Log.e("session",""+session.isOpened());
// dialog.dismiss();
if (session.isOpened()) {
/
List<String> permissions = session.getPermissions();
Log.e("current permissions",""+permissions);
if (!isSubsetOf(PERMISSIONS, permissions)) {
Log.e("if permissions=======",""+permissions);
Session.NewPermissionsRequest newPermissionsRequest = new Session.NewPermissionsRequest(getParent(), PERMISSIONS);
session.requestNewReadPermissions(newPermissionsRequest);
return;
}
// make request to the /me API
Request.executeMeRequestAsync(session, new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser user,Response response) {
// TODO Auto-generated method stub
Log.e("oncompletedddddddddddd","if open user");
if (user != null) {
Log.e("session","if open user");
Intent intent=new Intent(getParent(),FacebookPostActivity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
View view = CheckInTab.group.getLocalActivityManager().startActivity("q",intent).getDecorView();
// Again, replace the view
CheckInTab.group.replaceView(view);
// publishFeedDialog(strFacebookId);
}catch(Exception e){e.printStackTrace();}
}
// Check for publish permissions
}
});
}
}
});
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Session.getActiveSession().onActivityResult(getParent(), requestCode, resultCode, data);
}
private boolean isSubsetOf(Collection<String> subset, Collection<String> superset) {
for (String string : subset) {
if (!superset.contains(string)) {
return false;
}
}
return true;
}
I am getting the dialog below continuously after my Login screen, I also observed that even we click Cancel or Cross, again the same dialog is appearing.
Please suggest for the solution.
You can remove the app from the list of approved apps from Facebook itself. From your browser:
From the Facebook app on your phone:
After you've removed the app permissions from Facebook, you should be able to run your app again and it will allow you to login.
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.