Reputation: 5767
Does Guava Service have a similar purpose to Android Service?
Upvotes: 3
Views: 370
Reputation: 40720
The answer to your question depends on what you're actually trying to do with them. Guava's service classes are helpers, designed to assist you in building something which could be similar to Android's service implementation. Android's service implementation is known by and interacts with its environment, while Guava's classes just provide a framework with no pre-defined behaviours.
So you might be able to write an implementation of Android's services using Guava's service classes, but without adding code, Guava doesn't provide the run-time integration that Android implements.
To answer your comment: neither require separate threads (and Android's services won't run on a separate thread by default). An Android service maps more closely to Guava's AbstractIdleService class, but Android provides more functionality around when to start up and shut down the service than Guava does.
Upvotes: 5