A method for detecting deviation from a preferred cervical spine posture when using a mobile device is disclosed. The mobile device uses a front-facing camera to capture images of the user and apply a nostril tracking algorithm to the images. The nostril tracking algorithm is used in real-time to measure displacement of the user's nostrils and correlate the nostril displacement to a cervical spine flexion angle. The user's cervical spine flexion angle is communicated using an alarm device, such as a row of lights, which allows the user to monitor and correct their posture and avoid potential injury.