I refer to API Demo that comes with the android guide book.
In it, I realise something disturbing for remote service.
If you start the RemoteService with RemoteServiceController and later on you bind to RemoteServiceController to RemoteService, you get to see the "Received from service: (Number)". After each second, the number increases.
If you get out of this view and leave the RemoteService running for a short while and then come back, the number should be a much larger value, say 60 if u left for 60 seconds. However, if you leave this view and allow the screen to sleep for a significantly longer time say 10 minute and come back and check the number, the number would only be around 200 or so. If the service is indeed running at the background, shouldnt it show 600.
My point is, does the runner,handler,or thread called by a remote service actually stop after a while when the screen goes off to sleeping mode? If so, how useful is remote service then if it doesnt allow a thread to continue running when the screen goes off.
Then again, i am sure something can be run infinitely at the background since this is what happen to the TIME, ALARM CLOCK ect. How is this done?
Please give some advice. Thanks