The apps use the accelerometer in your smart phone to determine and record your sleep cycle. They also all feature an alarm timed to wake you during your lightest sleep.
What exactly is an accelerometer? It is a device built in to most modern smart phones that measures g-force. In this case, the apps are measuring and recording the movement of your bed, as you need to place the phone on your mattress in order for it to record your nightly sleep patterns.