To solve the problems in pedestrian dead reckoning algorithms for indoor positioning, of which the step recognition accuracy for step detection is not high enough, the synchronous control is not precise enough, and there is a large location deviation. An algorithm of improved finite state machine step detection for the activity of flat holding smartphone was proposed. A finite number of states were set to correspond to the trend of resultant acceleration variation during walking. Step detection and step cycle estimation were realized based on adjacent resultant acceleration difference and several thresholds of climbing and descending times. Experimental tests were conducted by two testers in 211 meters corridors with flat holding smartphone, respectively. Experimental results show that the accuracy of two step detection tests are both 100% by using the improved algorithm. It is 0.004 seconds earlier on average than the actual time for each step. And the average location error is 0.384m. Compared to the auto-correction analysis and acceleration differential based on finite state machine algorithms, the accuracy of step recognition, synchronous control and location estimation are improved at least 0.7%, 60% and 21.15%, respectively. The proposed algorithm behaves better than the existing algorithms in the aspects of the step recognition, the synchronous control and location estimation.