Does Guava Service have a similar purpose to Android Service?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.