CordovaWebView: TIMEOUT ERROR

前端 未结 4 927
庸人自扰
庸人自扰 2021-02-15 22:41

I am implementing jquery.min.js in my phonegap app but it is showing me the CordovaWebView time out error. I have also tried

super.setIntegerProperty(\"loadUrlTi         


        
相关标签:
4条回答
  • 2021-02-15 23:28

    I guess your main script is too long to execute :

    //code executed after the loading of the page (if your using jquery)
    $(function() {
    
        //if this method is too heavy and takes too long to execute, it will trigger the TIMEOUT ERROR. 
        doSomeStuff();
    });
    

    Won't may want to add a timeout on this method in order to let the application launch, then start your heavy script (you may want to display a loading image or something like that).

    code snippet :

    //code executed after the loading of the page
    $(function() {
    
        //in mobile environment, this timeout leaves time for the app to launch before we start any heavy process.
        setTimeout(function(){
            doSomeStuff();
        },100);
    });
    
    0 讨论(0)
  • 2021-02-15 23:34

    That is the issue with the emulators as system is slow so it takes time and giving CordovaWebView time out error.
    So i run it in device with good RAM and it is working.

    0 讨论(0)
  • 2021-02-15 23:38

    its about getting timeout from the corodova web view restarting application from the same AVD will cure this you don,t have to give a 'run as'command to the application just select the app from the phone or AVD and run it again it may because of your device is very slow and not giving quick respond to the variables that you have given to the identification of value

    Me-

    0 讨论(0)
  • 2021-02-15 23:43

    You can increase the timeout value, see this link

    super.setIntegerProperty("loadUrlTimeoutValue", 60000); 
    

    update

    From the example I replaced my old code with this snippet and it works:

    I added import org.apache.cordova.* and I put super.loadUrl(Config.getStartUrl()) instead of the url method

    import org.apache.cordova.*;
    import android.os.Bundle;    
    public class MyApp extends DroidGap
    {    
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState)
        {           
            super.onCreate(savedInstanceState);
            super.loadUrl(Config.getStartUrl());            
        }
    
    0 讨论(0)
提交回复
热议问题