Why does the heart rate stay at 0 bpm when I am recording an activity?

Check that you have granted the PAI app access to your Health data to read and write heart rate. To do so, open the Health app. Navigate to Sources then select the PAI app. You should see a screen like this: