31

I have a Android Webview and when I click on a link to download a file (image of pdf etc) I got a error message.

Error message:
Cannot call determinedVisibility() - never saw a connection for the pid

Any idea what I do wrong? Who can help please!?

Laurens V
  • 551
  • 1
  • 7
  • 19

11 Answers11

16

Just a bit of configuration:

    webview.getSettings().setJavaScriptEnabled(true);
    webview.getSettings().setDomStorageEnabled(true);
Burhan ARAS
  • 2,517
  • 25
  • 19
5

I got the same error and Burhans solution was not helping me. I think things went wrong when you´re trying to load different urls too fast.

Edit: Found a better solution credits go to user2652394 WebView must be loaded twice to load correctly

You have to do something like this:

        webView.postDelayed(new Runnable() {

            @Override
            public void run() {
                webView.loadUrl(landingpage);
            }
        }, 500);
Community
  • 1
  • 1
Dennis Allert
  • 580
  • 1
  • 9
  • 8
2

I faced the same issue.

Was solved by giving a WebView a static height (ie 300dp) or specifying minHeight value.

AlexVPerl
  • 7,652
  • 8
  • 51
  • 83
2

This problem in my case produce by incorrect settings in layout properties. I had used:

    <WebView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/webView"
    android:layout_below="@+id/textView"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_alignParentBottom="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="false"
    android:layout_alignWithParentIfMissing="false" />

Instead of setting:

    <WebView
    android:id="@+id/webView"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_below="@+id/textView" />

The problems had been solved, when I removed "layout_alignParent" settings.

Hessam J.E
  • 82
  • 4
2

Background

Here is the source code of the method in the browser engine that gives the error (BindingManagerImpl.java), from Chromium source:

@Override
public void determinedVisibility(int pid) {
    ManagedConnection managedConnection;
    synchronized (mManagedConnections) {
        managedConnection = mManagedConnections.get(pid);
    }
    if (managedConnection == null) {
        Log.w(TAG, "Cannot call determinedVisibility() - never saw a connection for the pid: "
                + "%d", pid);
        return;
    }

Analysis

It's a rendering warning from content.

Consecutive calls to loadUrl cause a race condition. The problem is that loadUrl("file://..") doesn't complete immediately, and so when you call loadUrl("javascript:..") it will sometimes execute before the page has loaded.

Detail

For more detail see this stackoverflow answer.

Jon Goodwin
  • 9,053
  • 5
  • 35
  • 54
1

This is how I fixed a similar issue:

    mWebView.setWebChromeClient(new WebChromeClient());
    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.getSettings().setDomStorageEnabled(true);

    mWebView.setWebViewClient(new WebViewClient() {
        public boolean shouldOverrideUrlLoading(WebView view,String url) {
            return false;
        }
    });

    mWebView.loadURL(...
manuel
  • 356
  • 2
  • 9
1

Late to party, but might help some. May sound silly as hell, but the mistake I made was not adding http:// in the beginning of the URL.

0

Check whether internet permission is properly set on the Manifest file. Make sure that the permission tag should be outside of your Application tag.

<uses-permission android:name="android.permission.INTERNET" />

Hope this might help some one.

Manu Antony
  • 173
  • 1
  • 15
0

I found a workaround by using onPageFinished method instead of shouldOverrideUrlLoading. It also provides the needed URL in the list of arguments.

The only trick is to set a check so that the main logic of the method (in my case making a Toast) is not triggered when onPageFinished gets called on the the page load itself.

Bord81
  • 525
  • 2
  • 8
  • 23
0
mWebView.setDownloadListener(new DownloadListener() {
  @Override
  public void onDownloadStart(String url, String userAgent, String contentDisposition, 
    String mimetype, long contentLength) {
    Log.d("download",url);
  }
});
pedrofurla
  • 12,763
  • 1
  • 38
  • 49
  • 3
    A helpful answer should always explain why the problem (error) is occurring as well as explaining why the suggested answer (your code) should work or fix it. Without any explanation this answer is not helpful - this is very important especially for a question that already has a number of answers submitted. – ishmaelMakitla Sep 15 '17 at 05:36
0

I faced the same problem. I can fix my issue by giving this code:

webView.postDelayed(new Runnable() {
        @Override
        public void run() {
            webView.loadUrl(url);
        }
    }, 500);

instead of:

webview.loadUrl(url);

then, set the url starts with https://

sabith.ak
  • 255
  • 4
  • 12