How to count the health of apples throughout the year?

The step counting function is generally realized by acceleration sensor and gyroscope. This specific working principle can be Baidu. Simply put, it is to confirm the motion state by using the acceleration and angular velocity changes of the equipment during the motion.

When walking, the movements are gentle, and the changes of acceleration and angular velocity tend to be gentle. Data collected within the range set by the system will be recognized as "walking". Similarly, when you walk fast, the acceleration of angular velocity will increase, and it will be recognized as "running" in a certain range.

That's why when you shake your phone regularly, it will recognize "you are exercising" and then record the steps.