0

I'm developing a client-server android application, which makes use of REST protocol.

Basically I upload a picture to the server first and then process it on a server and then update the status of this picture in android application (from new to processed);

so the user needs to press "refresh" to receive the renewed list of processed pictures from the server...

I'm surely don't like it...

is it possible to have some sort of callback after the server has completed processing? I think i'm looking for somewhat like... ajax, in other words, the server needs to trigger the event of updating the list, not users "refresh" button pressing. I also don't wan't to ask server every ~2 seconds after sending the picture if it's been processed or not ... i think there must be more elegant solution.

What is the correct way to implement such a functionality?

I can change both server and android parts of an application

thank you in advance!

tania
  • 1,086
  • 2
  • 12
  • 31
  • Why can't you just send a message from server to client? – Semyon Danilov Aug 08 '13 at 13:54
  • yeh, my question is...how do i do that? – tania Aug 08 '13 at 14:44
  • Use this answer (http://stackoverflow.com/questions/3696986/how-can-i-send-an-http-response-using-only-standard-network-libraries) to learn how to send responses for your requests (if you don't know). And then simply create and send response like "PROCESSING", "DONE" etc – Semyon Danilov Aug 08 '13 at 15:13

1 Answers1

0

This is what Google Cloud Message is for, the server notifies a device or devices that there is new stuff to get from the server. the phone makes the call to the server to get all the new information and process it

Another option is using xmpp, take a look at asmack

tyczj
  • 71,600
  • 54
  • 194
  • 296