How does the app know at what time the sun rises?

Your smartphone GPS will relay the location of your home to the system. It also has an astronomical clock that calculates the daily sunrise, sunset and twilight times for your location.