Last Updated: February 25, 2016
· shupal

Prevent timeouts in phonegap on android emulator

First way to avoid a timeout on application start up is to increase the TimeoutValue before the index.html is loaded.

super.setIntegerProperty("loadUrlTimeoutValue", 70000);

But sometimes it doesn't work (or just in my case). A alternate way is to create a new html file called helper.html or something else.

<!-- helper.html -->
<!DOCTYPE html>
            <meta name="viewport" content="width=device-width, initial-scale=1">

After the file is loaded we say that our new window.location is our normal index.html.
Just change the line in your MainActivity class




and your app is not running into a timeout on the emulator.

2 Responses
Add your response

This is the case where the index.html file times out. I have an issue where I am trying to embed a youtube url inside a popup in my app. When internet is not present or it is slow enough, it gives an alert saying : "Couldn't load url:" . When I click on the OK button, the app crashes.
I tried increasing the super.setIntegerProperty("loadUrlTimeoutValue",60000) value inside file, but it doesn't seem affecting the youtube url as it crashes before the timeout.

Any pointers on this would be greatly appreciated.Thanks.

over 1 year ago ·

The video is embed? Via inAppBrowser Plugin?

over 1 year ago ·