0
votes

I am using google feeds api in a phonegap app and when the connection gets too slow (as I think) an error saying "The connection to the server was unsuccessful. (file:///android_asset/www/index.html)" pops up instead of loading the app. What should I do to eliminate this error? Please help buddies...

2
Is it throwing an shouting red "TIMEOUT ERROR" in the log?? Probably your code is too heavy for the application to handle in the current timeout...Alexandre Wiechers Vaz
Yes there is a TIMEOUT ERROR in the log. This happened when the internet connection went slow. It was fine when Im using the app under fast internet connections. What should I do?Teshan Nanayakkara
You can set a timeout to check it. For example, if your ajax call(Assuming you're making an ajax call) is taking more than 5 seconds to return an response, abort this call and try again laterAlexandre Wiechers Vaz

2 Answers

1
votes

In your main Activity, increase the timeout

super.loadUrl("something.com",60000);
0
votes

May be below code help you out

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    super.setIntegerProperty("splashscreen", R.drawable.splash);
super.loadUrl("file:///android_asset/www/index.html", 10000);
}

This lets cordova wait for 10 seconds to startup.