Speedup Webview

TrisectDevelopment

Active Member
Licensed User
Longtime User
I have made an App with a Webview but it is slow when it download the website.

Is it possible to speed it up?

The website I show come from a RSS feed.
 

warwound

Expert
Licensed User
Longtime User
I have made an App with a Webview but it is slow when it download the website.

Is it possible to speed it up?

The website I show come from a RSS feed.

Is the problem that the remote site is slow to serve the RSS feed?

Is the problem that the device's internet connection is too slow?

There's not really much you could do about either i think.

The web page is an RSS feed - so it's dynamic content not static.
How often does that content change?
If it changes say once a day AND the slowdown in your program is because the remote site is slow to produce the feed then you could probably set up a script that once a day fetches the feed from the remote site and caches it.
Your program could request the feed from the cached version which may be quicker than the remote site dynamically generating it each time it is requested.

You'd need a web hosting setup with PHP support and the ability to create the local cached copy of the feed.

But if the feed is updated at unknown intervals and your application must have the very latest version of the feed then the caching solution is no good to you.

Martin.
 
Upvote 0

TrisectDevelopment

Active Member
Licensed User
Longtime User
I often get a total white page and nothing else.
Is there a way to check if the Webview has something?
Maybe a timer that checks if it has been white for to long and then reload or something.
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
Hi.

The default B4A WebView has no way (i think) of notifying your activity that a page load has timed out.

Looking at the Android SDK docs it looks like that error notification is part of the WebView's WebViewClient's onReceivedError() method.

Take a look at this page: Page timeout test.

You can call the same page with a seconds parameter to tell the page how long to wait before it serves any response text:

http://code.martinpearman.co.uk/deleteme/b4a_page_timeout.php?seconds=60

I loaded the page with various delays in a WebView, a delay of 180 seconds was enough to trigger a timeout.

Once the timeout occurs the WebView displays the 'Web page not available' error message: 'The web page at blah blah blah might be temporarily down or it may have moved permanently to a new web address'.

Do you ever see this error message in your WebView?

[edit]
The log viewer shows this message when the timeout occurs:

request time failed: java.net.SocketException: Address family not supported by protocol

[/edit]

Try loading the RSS feed in your desktop browser a few times - try it at different times of the day too.
Do you see the feeds always load instantly on your desktop or does it tend to be a (very) slow loading feed?

Martin.
 
Last edited:
Upvote 0
Top