0

I recently try twitter app on Android-based phone ( HTC HD Desire , I guest). With twitter app, when I try to 'tweet' a message, my twitter app on the phone notify the change nearly in real-time.

I did some search and found out I could get "message" from Twitter in JSON format, but is that true that my app on android phone must have a separate thread running in the background to get information from server in some kind of format ( like JSON ..) than update my wall on the phone ??

If this really happened, I think it would be a disaster for my phone because it's should have run out of battery very soon.

Is there anyway to get the same result but not having a thread run in background to do the checking-updating work ?

stema
  • 90,351
  • 20
  • 107
  • 135
toantran
  • 1,789
  • 17
  • 25

2 Answers2

2

Do you want this information for writing your own application, or for finding out how the existing app you use works?

If it is about the latter, have you considered asking the app developer about the details on this? I am sure they could answer how much the application is polling, or if some sort of push mechanism is used. That answer might be more helpful than the guesswork that stackoverflowers can do for you.

E. T.
  • 847
  • 10
  • 26
  • Oh, thanks Jonas, I have a similar apps in the way it works, so I just wonder how twitter apps work, so, maybe I could learn something great from it. – toantran Feb 12 '12 at 00:31
1

If you want the updates to come through in real time, you'll have a Service running in the background that's constantly polling.

Alternatively you could put the heavy lifting to server side and implement a push mechanism. Upside, better battery life for your client. Downside, you have to pay money for infrastructure that will poll twitter, then push to clients.

jlindenbaum
  • 1,891
  • 18
  • 28
  • 1
    Could use a micro instance on AWS for proof of concept? Both Unix and Windows are available. Good answer though, however I am very cautious of using services. An Alarm would be better. – Graham Smith Feb 11 '12 at 17:50