我有一个应用程序,我正在为我的用户设置 facebook 登录。我正在测试设备上未安装 Facebook 应用程序的场景,在该场景中,它重定向到另一个Activity
打开对话框并显示WebView
带有相应字段的应用程序。一旦我通过这个登录,它会继续到我的应用程序的主页。但是WebView
当我回击时,之前的活动仍然存在。知道如何从我的 main 完成它Activity
吗?
编辑:从我调用我的 DoLogin 类的位置发布函数的代码。
public void doFacebookLogin(){
Session.openActiveSession(this, true, new Session.StatusCallback() {
// callback when session changes state
@Override
public void call(final Session session, SessionState state, Exception exception) {
if(!loggedIn){ // loggedIn is a boolean value which checks if the authentication has been successful
if(session.isOpened()){
Log.d("FB", "is opened");
Request.executeMeRequestAsync(session, new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser user, Response response) {
OpenRequest openRequest = new OpenRequest(FacebookHandler.this);
List<String> readPermissions = new ArrayList<String>();
readPermissions.add("email");
openRequest.setPermissions(readPermissions);
openRequest.setLoginBehavior(SessionLoginBehavior.SSO_WITH_FALLBACK);
//openRequest.setCallback();
NewPermissionsRequest rp = new NewPermissionsRequest(FacebookHandler.this,readPermissions);
session.requestNewReadPermissions(rp);
String accessToken = Session.getActiveSession().getAccessToken();
DoLogin login = new DoLogin();
login.execute(accessToken);
}
});
}else{
Toast t = Toast.makeText(getApplicationContext(), "Facebook Login error", Toast.LENGTH_LONG);
t.show();
}
}
}
});
}