@AlanMarcus' answer is correct, but I feel it might be missing the point of the question. Or maybe I'm missing it.
I feel like the question is asking how long exposure can work on digital devices. In principle, digital sensors are not that different from analog ones. The surface doesn't change chemically, but it does accumulate electric charge. That process takes time, just like in analog sensors, and it can never happen instantaneously. The brighter the light, the faster the accumulation of charge is, but you can accumulate the same amount of charge with a weaker light and more exposure time.
The difference is that you can't reset film, but you can reset a digital sensor. You do this by discharging all the charge that built up on it. This means that digital sensors don't really need a mechanical shutter. In fact, none of the cameras I work with have a mechanical shutter and I'd be surprised if any phones had them.
The digital sensor is simply constantly being exposed to light. When you wish to take a picture, you reset the sensor so all the charge "wells" are empty. Then the wells immediately start filling up again as they naturally gather light. When you stop the acquisition, you trigger the electronics which measures and records the charge levels of all the pixels at that point in time.
Usually, the time between resetting the sensor and measuring the charge levels is a small fraction of a second. For long exposure photography, you just increase the time between resetting and measuring.