When any components change, does the app need to be open to actually acknowledge the changes

I want to make a fitness app that tracks the amount of steps a person takes during the day using the “When accelerometer changes” function. Will it still run the code to add the steps even if the app isn’t actually open?

No. The only component that can “ run in the background” it would seem are the push message capabilities