Localization in harsh environments constitutes one of the main pillars for the provision of context-aware services in gerontechnology. The dual perspective followed to meet this goal comprises fingerprinting and ranging techniques. Fingerprinting is well suited for critical areas where the high accuracy needed justifies an exhaustive calibration effort. Ranging is more adequate for non-critical spaces where lower accuracy requirements favor easy-to-deploy alternatives. This paper presents a generalized Bayesian framework for wireless localization that integrates fingerprinting and ranging. The evaluation of this framework under realistic conditions showed a remarkable improvement over state-of-the-art techniques and enabled real-time patient tracking for gerontechnology.