【问题标题】:Android 4.4; Open Chrome Webapp with Intent安卓4.4;使用 Intent 打开 Chrome Webapp
【发布时间】:2014-05-23 07:30:04
【问题描述】:

我正在尝试在我的应用中使用 WebRTC 实现网页。由于 4.4 WebView 仍然不支持 WebRTC,我正在尝试寻找另一种方法来在具有 WebRTC 功能的 chrome 中全屏打开网页。

我是否可以使用 Intent 在“WebApp”模式下打开 Chrome?

【问题讨论】:

  • 尝试使用 "browser.setWebChromeClient(new WebChromeClient() {}" 了解一下,也许它可以工作
  • 已经尝试过了,没有任何运气。

标签: android webrtc google-chrome-app


【解决方案1】:

试试这个

webView.setWebViewClient(new MyWebClient());
webView.loadUrl(webViewUrl);

MyWebClient.java

public class MyWebClient extends WebViewClient {
    @Override
    /**
     * Notify the host application that a page has started loading.
     */
    public void onPageStarted(WebView view, String url, Bitmap favicon) {
        super.onPageStarted(view, url, favicon);
    }

    @Override
    /**
     * Give the host application a chance to take over the control when a new url is about to be loaded in the current WebView.
     */
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        @SuppressWarnings("unused")
        Uri uri = Uri.parse(url);
        // Intent intent = new Intent(Intent.ACTION_VIEW, uri);
        // startActivity(intent);
        view.loadUrl(url);
        return true;
    }

    @Override
    /**
     * Notify the host application that a page has finished loading.
     */
    public void onPageFinished(WebView view, String url) {
        super.onPageFinished(view, url);

    }
}

【讨论】:

猜你喜欢
  • 2017-08-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-04-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多