Simon MacDonald | 8 Jan 03:08 2013
Picon

Re: Android WebView exceptions and timeouts

I can't reproduce the 10 minute waiting problem. What version of
PhoneGap are you using and can you give a more detailed reproduction
scenario? Let us know if you are setting anything up in the main Java
class that extends from DroidGap.

Simon Mac Donald
http://hi.im/simonmacdonald

On Mon, Jan 7, 2013 at 7:24 AM, jxp <princej.ws01@...> wrote:
> I am attempting to simulate some possible errors in my application.
>
> One way I am doing this is adding a "bad" link on to a page (e.g. <a
> href="http://1.2.3.4/SomeSite">Click for error</a>)
>
> This generates an error in the WebView. Firstly this error takes 10 minutes
> to occur (on Android VM), is there any way to control this timeout?
>
> 01-07 12:13:34.473: D/DroidGap(667):
> onMessage(onPageStarted,http://1.2.3.4/SomeSite)
> 01-07 12:23:01.984: D/Cordova(667): CordovaWebViewClient.onReceivedError:
> Error code=-6 Description=The connection to the server was unsuccessful.
> URL=http://1.2.3.4/SomeSite
>
> I tried setting loadUrlTimeoutValue to 10,000 (10 seconds) but I still wait
> 10 minutes for this error.
>
>
> Secondly the default error handling is to show an alert and then close the
> app.
> There is the option of specifying errorUrl to load a standard error page. Is
(Continue reading)

jxp | 8 Jan 14:44 2013
Picon

Re: Android WebView exceptions and timeouts

I'm using PhoneGap 2.2

I had the 10 minute scenario on both an Android 2.2 VM and an actual 2.3.5 HTC phone.
My droidgap class is simply

    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        super.setIntegerProperty("loadUrlTimeoutValue", 10000);
        super.setStringProperty("errorUrl", "file:///android_asset/www/error.html");
        super.loadUrl("file:///android_asset/www/index.html");
    }

In the device ready event I am setting window.location = 'http://1.2.3.4/SomeSite'

10 minutes is far too long to wait for a user. I was thinking it should be more like 5-10 seconds.


On Tuesday, January 8, 2013 2:08:36 AM UTC, Simon wrote:

I can't reproduce the 10 minute waiting problem. What version of
PhoneGap are you using and can you give a more detailed reproduction
scenario? Let us know if you are setting anything up in the main Java
class that extends from DroidGap.

Simon Mac Donald
http://hi.im/simonmacdonald


On Mon, Jan 7, 2013 at 7:24 AM, jxp <prince...-PkbjNfxxIAQqdlJmJB21zg@public.gmane.org> wrote:
> I am attempting to simulate some possible errors in my application.
>
> One way I am doing this is adding a "bad" link on to a page (e.g. <a
> href="http://1.2.3.4/SomeSite">Click for error</a>)
>
> This generates an error in the WebView. Firstly this error takes 10 minutes
> to occur (on Android VM), is there any way to control this timeout?
>
> 01-07 12:13:34.473: D/DroidGap(667):
> onMessage(onPageStarted,http://1.2.3.4/SomeSite)
> 01-07 12:23:01.984: D/Cordova(667): CordovaWebViewClient.onReceivedError:
> Error code=-6 Description=The connection to the server was unsuccessful.
> URL=http://1.2.3.4/SomeSite
>
> I tried setting loadUrlTimeoutValue to 10,000 (10 seconds) but I still wait
> 10 minutes for this error.
>
>
> Secondly the default error handling is to show an alert and then close the
> app.
> There is the option of specifying errorUrl to load a standard error page. Is
> there any way for this error page to receive information on the exception
> that occurred?
>
> --
> -- You received this message because you are subscribed to the Google
> Groups "phonegap" group.
> To post to this group, send email to phon...-/JYPxA39Uh4Ykp1iOSErHA@public.gmane.orgm
> To unsubscribe from this group, send email to
> phonegap+u... <at> googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/phonegap?hl=en?hl=en
>
> For more info on PhoneGap or to download the code go to www.phonegap.com
>
> To compile in the cloud, check out build.phonegap.com
>
>

--
-- You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phonegap-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
phonegap+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en
 
For more info on PhoneGap or to download the code go to www.phonegap.com
 
To compile in the cloud, check out build.phonegap.com
 
 
jxp | 10 Jan 12:30 2013
Picon

Re: Android WebView exceptions and timeouts


Having a look through the Cordova source code, my impression is that the timeout is only applied on loading a url and not on the onPageStarted.
When setting window.location in javascript we only seem to get onPageStarted and not loadUrl (the loaded page is setting the location to another page).

Is there another way around this or should I log a bug/feature request on jira?

I've included a (nearly) full log trace below where you can see there is no loadUrl message from the web view for the http://1.2.3.4/SomeSite url
(But there is an onPageStarted)

01-10 11:11:12.611: D/DroidGap(534): DroidGap.init()
01-10 11:11:12.771: D/CordovaWebView(534): >>> loadUrl(file:///android_asset/www/index.html)
01-10 11:11:12.771: D/PluginManager(534): init()
01-10 11:11:12.781: D/CordovaWebView(534): >>> loadUrlNow()
01-10 11:11:12.781: D/DroidGap(534): Resuming the App
01-10 11:11:12.912: D/SoftKeyboardDetect(534): Ignore this event
01-10 11:11:12.971: D/SoftKeyboardDetect(534): Ignore this event
01-10 11:11:13.411: I/ActivityManager(72): Displayed activity org.mnetics.im2.retail/.IM2Online: 3186 ms (total 3186 ms)
01-10 11:11:14.991: D/DroidGap(534): onMessage(onPageStarted,file:///android_asset/www/index.html)
01-10 11:11:17.291: D/Cordova(534): onPageFinished(file:///android_asset/www/index.html)
01-10 11:11:17.291: D/DroidGap(534): onMessage(onNativeReady,null)
01-10 11:11:17.291: D/DroidGap(534): onMessage(onPageFinished,file:///android_asset/www/index.html)
01-10 11:11:17.801: I/Database(534): sqlite returned: error code = 14, msg = cannot open file at source line 25467
01-10 11:11:18.051: D/CordovaLog(534): Falling back on PROMPT mode since _cordovaNative is missing.
01-10 11:11:18.051: D/CordovaLog(534): file:///android_asset/www/cordova-2.2.0.js: Line 1032 : Falling back on PROMPT mode since _cordovaNative is missing.
01-10 11:11:18.051: I/Web Console(534): Falling back on PROMPT mode since _cordovaNative is missing. at file:///android_asset/www/cordova-2.2.0.js:1032
01-10 11:11:18.271: D/DroidGap(534): onMessage(networkconnection,3g)
01-10 11:11:18.451: D/DroidGap(534): onMessage(spinner,stop)
01-10 11:11:18.661: D/CordovaLog(534): Received Event: deviceready
01-10 11:11:18.661: D/CordovaLog(534): file:///android_asset/www/js/index.js: Line 40 : Received Event: deviceready
01-10 11:11:18.681: I/Web Console(534): Received Event: deviceready at file:///android_asset/www/js/index.js:40
01-10 11:11:18.681: D/DroidGap(534): onMessage(onPageStarted,http://1.2.3.4/SomeSite)
01-10 11:11:19.411: D/DroidGap(534): onMessage(spinner,stop)
01-10 11:20:47.031: D/Cordova(534): CordovaWebViewClient.onReceivedError: Error code=-6 Description=The connection to the server was unsuccessful. URL=http://1.2.3.4/SomeSite
01-10 11:20:47.041: D/DroidGap(534): onMessage(onReceivedError,{"errorCode":-6,"url":"http:\/\/1.2.3.4\/SomeSite","description":"The connection to the server was unsuccessful."})
01-10 11:20:47.051: D/CordovaWebView(534): showWebPage(file:///android_asset/www/error.html, false, true, HashMap
01-10 11:20:47.051: D/CordovaWebView(534): >>> loadUrl(file:///android_asset/www/error.html)
01-10 11:20:47.061: D/CordovaWebView(534): >>> loadUrlNow()
01-10 11:20:47.061: D/DroidGap(534): onMessage(onPageStarted,http://1.2.3.4/SomeSite)
01-10 11:20:47.181: D/Cordova(534): onPageFinished(http://1.2.3.4/SomeSite)
01-10 11:20:47.181: D/DroidGap(534): onMessage(onNativeReady,null)
01-10 11:20:47.181: D/DroidGap(534): onMessage(onPageFinished,http://1.2.3.4/SomeSite)
01-10 11:20:47.261: D/DroidGap(534): onMessage(onPageStarted,file:///android_asset/www/error.html)
01-10 11:20:48.441: D/Cordova(534): onPageFinished(file:///android_asset/www/error.html)
01-10 11:20:48.441: D/DroidGap(534): onMessage(onNativeReady,null)
01-10 11:20:48.441: D/DroidGap(534): onMessage(onPageFinished,file:///android_asset/www/error.html)
01-10 11:20:48.761: I/Database(534): sqlite returned: error code = 14, msg = cannot open file at source line 25467
01-10 11:20:49.031: D/CordovaLog(534): Falling back on PROMPT mode since _cordovaNative is missing.
01-10 11:20:49.031: D/CordovaLog(534): file:///android_asset/www/cordova-2.2.0.js: Line 1032 : Falling back on PROMPT mode since _cordovaNative is missing.
01-10 11:20:49.031: I/Web Console(534): Falling back on PROMPT mode since _cordovaNative is missing. at file:///android_asset/www/cordova-2.2.0.js:1032
01-10 11:20:49.121: D/DroidGap(534): onMessage(spinner,stop)

--
-- You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phonegap-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
phonegap+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en
 
For more info on PhoneGap or to download the code go to www.phonegap.com
 
To compile in the cloud, check out build.phonegap.com
 
 

Gmane