Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I have to develop an Android library that should frequently communicate with a server in the background. Access to the lib Object should be guaranteed everywhere in the Apps that will use it, so I decided to extend the Application class from Android API and return the instance created when an App is started, every time it's needed.

The lib sends frequent polls to the server (Not the best practice, I know. But it's a given system and still experimental). If there's a message for the App to be parsed, it should call some kind of listener, which has to be registered by the App. When onPause is called the Lib should continue the communication for a defined time.

So my questions are:

  • Would it be the best way to implement the lib as an intent service?
  • Is it the right approach to extend the Application class?

This is my first library project on Android, so excuse me if some of the questions seem to be too basic.

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.