Android Webview 和 Facebook 登录不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23790231/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Android Webview and Facebook Login Not working
提问by Gayan Hewa
I am having a problem with a WebView
app that I am working on.
我正在使用的WebView
应用程序出现问题。
We have this responsive website that is being displayed through an android WebView
.
我们有这个响应式网站,通过 android 显示WebView
。
The website has a Sign in with Facebookoption, this works fine in a mobile browser and on the website itself. Whenever I try to use the WebView
app to login using Facebook
, it results in a white screen.
该网站有一个使用 Facebook 登录的选项,这在移动浏览器和网站本身中都可以正常工作。每当我尝试使用该WebView
应用程序登录时Facebook
,都会导致白屏。
I am having difficulties finding a solution to get this to work.
我很难找到解决方案来让它发挥作用。
Appreciate any advise.
感谢任何建议。
回答by Gayan Hewa
I was able to find a solution based on a previous question on stackoverflow.com
我能够根据之前在 stackoverflow.com 上的问题找到解决方案
Making facebook login work with an Android Webview
使用 Android Webview 使 facebook 登录工作
Here is a link to my MainActivity : http://pastebin.com/KdzfhqDJ
这是我的 MainActivity 的链接:http: //pastebin.com/KdzfhqDJ
回答by kabuko
I'm fairly certain it's this same issue. Essentially it opens in another window and WebView
doesn't support multiple windows out-of-the-box.
我很确定这是同一个问题。本质上,它在另一个窗口中打开,并且WebView
不支持多个开箱即用的窗口。
Luckily for you, unlike that question which was iOS-specific, if I recall correctly, it's possible to extend WebView
to support multiple windows. You'll need to extend WebChromeClient
, implement onCreateWindow
and use it in your WebView
.
幸运的是,与特定于 iOS 的问题不同,如果我没记错的话,可以扩展WebView
以支持多个窗口。你需要扩展WebChromeClient
,实现onCreateWindow
在你使用它WebView
。