Note that there are some explanatory texts on larger screens.

plurals
  1. POAJAX Requests to Self-Signed HTTPS Resources in Cordova/PhoneGap 2.1.0 Android Apps
    primarykey
    data
    text
    <p>I am trying to implement the workaround provided by Chris found <a href="https://stackoverflow.com/questions/10969043/phonegap-cordova-whitelisted-cross-domain-ssl-request-not-working-after-exportin/11856758">here</a> to allow a PhoneGap/Cordova-built Android app to make AJAX HTTPS requests to a server with a self-signed SSL certificate. I am using PhoneGap/Cordova 2.1.0, whereas Chris was using 1.7.0. I can create the MyWebViewClient class without issue. However, when I add this line of code...</p> <pre><code>this.setWebViewClient(this.appView, new MyWebViewClient(this)); </code></pre> <p>...to the MainActivity class' overridden init() method, I receive this error:</p> <blockquote> <p>The method setWebViewClient(CordovaWebView, MyWebViewClient) is undefined for the type MainActivity</p> </blockquote> <p>Here is my code for MyWebViewClient.java:</p> <pre><code>package [packagename]; import android.net.http.SslError; import android.webkit.SslErrorHandler; import android.webkit.WebView; import org.apache.cordova.CordovaWebViewClient; import org.apache.cordova.DroidGap; public class MyWebViewClient extends CordovaWebViewClient { public class MyWebViewClient(DroidGap ctx) { super(ctx); } @Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { handler.proceed(); } } </code></pre> <p>Here is my code for MainActivity.java:</p> <pre><code>package [packagename]; import android.os.Bundle; import org.apache.cordova.*; public class MainActivity extends DroidGap { @Override public void init() { super.init(); this.setWebViewClient(this.appView, new MyWebViewClient(this)); // Error occurs here } @Override public void onCreate(bundle savedInstanceState) { super.onCreate(savedInstanceState); super.setBooleanProperty("keeprunning", false); super.loadUrl("file:///android_asset/www/index.html"); } } </code></pre> <p>I do not have enough reputation, otherwise I would have just commented on Chris' answer. Also, I am not looking for a jQuery solution (I already know I can make a $.ajax() call to avoid this issue, but I am trying to keep jQuery out of my app).</p> <p>Any ideas? Your help is greatly appreciated!</p> <p><b>Edit:</b> Please see my comments below before responding.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload