Grabbing a service from anywhere in the app (Android) -


i created service has check repeatedly after given amount of time, should communicate app result of check, no matter activity app in precise time, should respond message accordingly.

i got point service performs check periodically, don't know how grab instance of service anywhere on app, in order results, stop service when app in background etc.

if using spring framework, can inject service want accessible in program.

otherwise can work singleton-pattern. example singleton pattern written in java can found here: http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html

or google "singleton pattern example". hope helps far.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -