how to ensure custom code keeps tracking even when onMenu or onHide

I have a question.. (hence I am writing this .. LOL..)

Anyways - i am writing and app and I have some custom code which I want to be executed at every second. This custom code is to keep track of Laps. However that I have noticed when I go into the app's menu, the custom code does not get called (the custom code/function is embedded inside onUpdate)

Since when I go into the MENU system, onUpdate doesn't get called. so.. that's a problem.

IS there a way to enable the custom code to always run in the background?