AFAIK it depends on how you code the app. The option in the compass app which enables running and being responsive in the background proves this idea.