chethan
chethan

Reputation: 426

How volley get updated image from server

I am using volley library in my android app for downloading image and I have few things to get clarify on this library .

  1. How the library will reflect updated image which is updated at server end on the same image URL , does library will take care automatically ? how does it work ?
  2. If library facilited this, what class file I have to refer to see functionality to understand.
  3. If library doesn’t have this facility then what needs to be done in order to get updated image at application side.

I hope, i will be receiving answer soon .

Upvotes: 3

Views: 146

Answers (2)

Philippe Banwarth
Philippe Banwarth

Reputation: 17755

Volley maintains a local cache and uses HTTP methods to know if and when the image needs to be reloaded.

This is based on headers like Cache-Control, Expires (to know when to check for a new version) and ETag to make conditionnal queries (this is a way for the client to say "I already have version XXX send me the content only if it is not the same")

So the server does not push updates, but it controls how often the client will check for updates.

For more details on how Volley handle the HTTP headers you can look at HttpHeaderParser.

Upvotes: 1

Mustansar Saeed
Mustansar Saeed

Reputation: 2790

I don't think Volley provides any callback which is used when update is done on server side. Volley is a networking api which is used to send the data to server.

For receiving updates, you have to implement Push Messaging feature. When an update is made on server side, server will send the push message to the application and then application will receive the notification and perform its actions.

Upvotes: 1

Related Questions