Hybrid phonegap build app, cordova = undefined

0
Hi All,  I am building a hybrid app through phonegap build and I am trying to call a url through a cordova InAppBrowser from a JavascriptSnippet widget. ie: cordova.InAppBrowser.open("{myUrl}", "_blank", "location=no,toolbar=no"); but keep getting a cordova is undefined error in the Android app apk?   A related question is here, but unfortunately not answered. https://community.mendix.com/link/questions/93350
asked
1 answers
3

Ok, so hopefully this may save someone hours of investigation someday in the future.

The root cause of my specific issue/problem was caused due to the fact that we use custom domains, and when downloading the phonegap package the environments are set to the Mendix Cloud urls by default. In a seperate SSO login process I was validating against the window.mx.remoteUrl + ‘/SSO’ value. The SSO login process redirects to the custom domain url and the original cordova in app browser window used for sso authentication was not properly closed after successful authentication. In fact the app continued in the new in app browser window where the external libraries are obviously not available. Thus opening an In App Browser window in an already open In App Browser Window.

Once I re-built the phonegap apk with environments pointing to the correct custom domain urls and my sso validation succeeded everything worked as expected.

answered