You'd have to write a ProntoScript Module and include it at the System Level. Then each activity would get this module.
Note that this only works with PEP2 as this is where modules were introduced.
Now, with regard to how the Pronto operates.
1. When docked, even though the screen is off, ProntoScript is able to run continuously.
2. When undocked, Pronto CPU goes into a semi-sleep mode effectively waking up every minute or so to keep wifi active. When this happens, some ProntoScript can start to run and then be suspended again.
So, now, a very terse example.
Put this closurecode into a JS file and include it from the System Activity. It will be run for every activity in the configuration.