我有一个应用程序,我正在为我的用户设置facebook登录。我正在测试设备上没有安装Facebook应用程序的情况,在该情景中,它会重定向到另一个Activity
,其中会打开一个对话框,并显示带有相应字段的WebView
。一旦我通过此登录,它将继续到我的应用程序的主页面。但是,当我按下时,之前的WebView
活动仍然存在。知道如何从主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();
}
}
}
});
}
答案 0 :(得分:0)
点击按钮,点击webview
Intent browserIntent = new Intent(Intent.ACTION_VIEW,Uri.parse(URL));
startActivity(browserIntent);
finish();