InAppBrowser problem in Android


#1

Hi,

I’ve installed the inappbrowser plugin to open a new window with external content, everything goes fine when using iOS or WebBrowser for testing, but in android the new window never shows.

Using logcat I’ve found this error message from plugin:

E/PluginManager(10308): Uncaught exception from plugin
E/PluginManager(10308): java.util.NoSuchElementException
E/PluginManager(10308): at java.util.StringTokenizer.nextToken(StringTokenizer.java:208)
E/PluginManager(10308): at org.apache.cordova.inappbrowser.InAppBrowser.parseFeature(InAppBrowser.java:324)
E/PluginManager(10308): at org.apache.cordova.inappbrowser.InAppBrowser.execute(InAppBrowser.java:115)
E/PluginManager(10308): at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:114)
E/PluginManager(10308): at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:95)
E/PluginManager(10308): at org.apache.cordova.PluginManager.exec(PluginManager.java:130)
E/PluginManager(10308): at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:59)
E/PluginManager(10308): at org.apache.cordova.engine.SystemExposedJsApi.exec(SystemExposedJsApi.java:41)
E/PluginManager(10308): at com.android.org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
E/PluginManager(10308): at com.android.org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:53)
E/PluginManager(10308): at android.os.Handler.dispatchMessage(Handler.java:102)
E/PluginManager(10308): at android.os.Looper.loop(Looper.java:135)
E/PluginManager(10308): at android.os.HandlerThread.run(HandlerThread.java:61)

But I don’t know how to fix it.

This is the piece of code that opens the new window:

var externalPaymentWindow = $window.open("http://www.simpletax.es/paypal.html","payPal",'_blank', 'location=yes,enableViewportScale=yes');
        //frm.submit();
        
    // listen to page load events
    externalPaymentWindow.addEventListener('loadstart', function(event) {
        var url = event.url;
        if (url.indexOf("http://www.simpletax.es/simpletaxci/") !== -1) {
            externalPaymentWindow.close();
            // failed
        } else if (url.indexOf("http://www.simpletax.es/simpletaxci/") !== -1) {
            externalPaymentWindow.close();
            //success
        }
        
        if(event.url.match("http://www.simpletax.es/simpletaxci/")){
            externalPaymentWindow.close();
        }
    });
        
    });

I’ve downloaded and installed cordoba whitelist plugin, configured it to allow everything from all sites.

Thanks in advanced.

Best regards


#2

I have no idea about the root cause but looking at your code I see that you use it for PayPal, so as a workaround why not using PayPal-Cordova-Plugin?
I use it and it’s great cause it’s native, for instance it can take a picture of your card and OCR the numbers.


#3

Hi, I’ve tried it but I was completely unable to make it working. Samples are not clear for me when trying to adapt the code to use with my ionic app.

If you were so kind to provide me a full sample I really appreciate it.

Thanks


#4

I did follow what was described in this topic.

I can provide a full example by the end of next week.


#5

Thank you so much for your help, I’ll keep you posted.

Best regards


#6

Finally I’ve got it working using the paypal-plugin!!!

Thanks!!!