[ 
https://issues.apache.org/jira/browse/CB-12754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15995815#comment-15995815
 ] 

Peter Olszowka commented on CB-12754:
-------------------------------------

Here's an excerpt of that portion of the code.  Does the excerpt include what 
you need?  Yes, I use listeners, but don't find they always work--especially 
"loaderror".

    connect: function() {
        this.wrappedOnLoadStop = this.onLoadstop.bind(this);
        this.wrappedOnLoadError = this.onLoaderror.bind(this);
        this.timeout = window.setTimeout(this.wrappedOnLoadError, 7500);
        this.cgwin = cordova.InAppBrowser.open(this.url, "_blank", 
"EnableViewPortScale=yes,toolbar=no,location=no,hidden=yes" );
        this.cgwin.addEventListener("loadstop", this.wrappedOnLoadStop);
        this.cgwin.addEventListener("loaderror", this.wrappedOnLoadError);
    },

    onLoadstop: function() {
        if (this.waitingForRetry) {
            this.loadedLate = true;
        } else {
            SpinnerPlugin.activityStop();
            window.clearTimeout(this.timeout);
            this.cgwin.removeEventListener("loadstop", this.wrappedOnLoadStop); 
//doesn't seem to work, hence use of loadedLate flag
            this.cgwin.removeEventListener("loaderror", 
this.wrappedOnLoadError);
            this.cgwin.show();
            this.usingUniversalLink = false; // We're through with this flag.  
Reset for next time.
            window.setInterval(this.pollInAppBrowserForLink.bind(this), 500);
        }
    },


> inAppBrowser crashing on Android
> --------------------------------
>
>                 Key: CB-12754
>                 URL: https://issues.apache.org/jira/browse/CB-12754
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-android, cordova-plugin-inappbrowser
>            Reporter: Peter Olszowka
>
> Using cordova-plugin-inappbrowser version 1.7.0
> Getting many crash reports from Google play store with following stack trace:
> java.lang.NullPointerException: Attempt to invoke virtual method 'void 
> org.apache.cordova.inappbrowser.InAppBrowserDialog.show()' on a null object 
> reference
>       at 
> org.apache.cordova.inappbrowser.InAppBrowser$2.run(InAppBrowser.java:257)
>       at android.os.Handler.handleCallback(Handler.java:739)
>       at android.os.Handler.dispatchMessage(Handler.java:95)
>       at android.os.Looper.loop(Looper.java:145)
>       at android.app.ActivityThread.main(ActivityThread.java:6126)
>       at java.lang.reflect.Method.invoke(Native Method)
>       at java.lang.reflect.Method.invoke(Method.java:372)
>       at 
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
>       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
> The issue appears on many versions of Android including 4.4, 5.1, 6.0, & 7.0.
> You can try the app from the Google Play store: "cargurus"  
> I am unable to reproduce the error myself, but 25 users/day are reporting it.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to