Rba*_*bar 6 javascript android google-calendar-api webview
我有一个网络应用程序,其中包含嵌入的谷歌日历.我现在想在我的Android应用程序中的WebView中的WebView中加载此Web应用程序.为了显示日历,用户必须按下打开Google Auth弹出窗口的按钮才能授权我拉取Google日历.这适用于桌面,iOS(浏览器和WebView)和Android(浏览器但不是 WebView),但Google日历登录/验证屏幕不会显示在Android WebView中.
我的活动(在Android中):
public class WebView extends AppCompatActivity {
android.webkit.WebView myWebView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_web_view);
myWebView = (android.webkit.WebView) findViewById(R.id.webview);
WebSettings webSettings = myWebView.getSettings();
////
// ISSUE: I expected one of these to allow the popup screen to show
webSettings.setJavaScriptEnabled(true);
webSettings.setDomStorageEnabled(true);
webSettings.setUserAgentString("Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36");
webSettings.setAllowFileAccess(true);
webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
webSettings.setSupportMultipleWindows(true);
// ISSUE^
////
myWebView.loadUrl("https://mywebsite.com/");
}
@Override
protected void onSaveInstanceState(Bundle outState ) {
super.onSaveInstanceState(outState);
myWebView.saveState(outState);
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
myWebView.restoreState(savedInstanceState);
}
}
Run Code Online (Sandbox Code Playgroud)
尝试的解决方案:
编辑:也尝试@萨格尔的建议之下使用onReceivedHttpAuthRequest,而不是弹出,但谷歌不允许OAuth的onReceivedHttpAuthRequest每这里,所以我需要弄清楚如何让OAuth的弹出窗口显示
有谁知道为什么Google Auth屏幕不能在Android上的WebView中显示?
真的卡住并坚持这一个,所以提前谢谢:)