Image won't refresh from download

NFOBoy

Active Member
Licensed User
Longtime User
I'm grabbing a png that I want to use in my Widget, and upon initial loadup it runs great. However, on each refresh, the image is staying the same (it's a semi-realtime gold quote), unless I switch to my 3G connection, then it refreshes just fine. But, if I switch back to Wi-Fi, the image goes back to the one when the widget was first run.

If I uninstall, and re-install, the image is refreshed to that point in time over wifi, but again, is stuck at that point in time.

What is strange to me, is that it refreshes back to an old image, after switch back from 3g.

Anyone know what setting I'm missing to make the image refresh every time?

Ross
 

NFOBoy

Active Member
Licensed User
Longtime User
Well, it's Monday (and the markets are open), and sure enough the widget works great when I'm connected to 3g, but on wi-fi, it's stuck at the first image that it grabbed when it started up in the morning. In fact, I can re-compile, install, grab with 3g and get new image, then re-compile, install and still get the first image from the morning)

Question, is there a cache feature of http that is hidden in the library? (maybe that's why it goes back?)

So, here's the source-code for anyone that might be able to tell me why it would do this.

Of note, I added job4 (of httpjob, which is the call to download the graphic) to run after it has downloaded the entire source page where the image is located (job3), in case that might get a refresh to occur (I'm shooting in the dark here, as it doesn't make sense to me why the type of connection should matter).

Also, the httpjob module has been modified to send a user agent that grabs the price quote from google, if I don't do that, then the page returned does not contain it (which made me wonder, what UserAgent does get sent when httpjob is run?)
 

Attachments

  • GoldWidget.zip
    13.8 KB · Views: 161
Upvote 0

NFOBoy

Active Member
Licensed User
Longtime User
Erel,

no errors. I am seeing in the logs all my statements to watch the code go through, and all parts of my widget update. (I put in code to actually indicate on the widget when it is doing a refresh, and I see that occur quite nicely)

What I don't understand is why the image actually goes Back to the image that it loaded at first run on Wi-Fi, but updates with 3g. There is no difference in the code calls (the graphic updates every minute or so, and i can watch that occur while on 3g, but not Wi-Fi)

The only thing I can think of (looking at the httpclient object), but don't know how to debug it, is the proxy. If I understand correctly, the proxy that the phone is using on wi-fi could be sending back just the old image (as that's the first one called, and it doesn't refresh it) Does that sound plausible to anyone?

If so, then can I do something to force the proxy to refresh the cache?
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
Are you saving the most recently downloaded image to external storage?
If so open the saved image using the device's Gallery or similar app and see if you see the most recent or old image.
Establish whether the downloaded image is the most recent image.

If you're not saving the image to external storage then i'd suggest you do so to enable you to view it from outside of your application.

Martin.
 
Upvote 0
Top