Behavioral biometrics identifies individuals according to their unique way of interacting with computer devices.Keystroke dynamics can be used to identify people, and it can replace the second factor in two-factor authentication.This paper presents a keystroke dynamics biometric system for user authentication in mobile devices. We proposeto use data from sensors of motion and position as features for the biometric system to improve the quality of userrecognition. The proposed novel model combines different anomaly detection methods (distance-based and densitybased) in an ensemble. We achieved the average EER of 8.0%. Our model has a retraining module that updates thekeystroke dynamics template of a user each time after a successful authentication in the system. All the process oftraining and retraining a model and making a decision is made directly on a mobile device using our mobileapplication, as well as keystroke data is stored on a device.