Disclaimer: This application has been written in 2014 and the android code might be quite outdated now. However, the bachelor thesis still provides some interesting insight into sleep monitoring.
A sleep monitoring application for Android. Includes a framework to create custom sleep monitoring apps. This application is a demonstration of the library's features.
This framework and the demo application were developed during my bachelor thesis at the Univeritiy of Ulm: http://dbis.eprints.uni-ulm.de/1183/1/BA_Mohr_15.pdf