android - Local service or remote service? -


I have a background service that should run permanently. The service has to communicate only with my activity

  1. How do I check the activity if the service is still running? Is service class a better prospect than a stable variable?

  2. Is there a remote service to be used in a separate process (to extend the life of the service) so that when the process of activity is killed then the service Still alive?

I have a background service that is permanently Will have to walk.

Users or Android will kill your service at any time. Please reconsider your architecture.

How do I check the activity if the service is still running?

Generally, you do not.

Is the service class better than a stable variable?

This will not work if the user or Android kills your service.

What is the benefit to using a remote service in a separate process (to increase the service life time) so that the service is still alive when the process of activity is killed?

Do nothing with a remote service whether the service runs after the activities are destroyed or not. If you call startService () , the service will be independent of any activity, as long as:

  • You stopService () Call service by
  • Service call stopSelf ()
  • Ends the Android service
  • User Settings
  • User terminates the service through "work killer" (at least Android 2.1 and earlier, at least)

Comments