Building out a sunrise alarm feature

Okay, I have seen lots of requests for a Sunrise feature. Let’s get what we want on ‘paper’.

I know there is a sunrise button in the UI, but that seems to only set the current sunrise for that day. It doesn’t seem to be dynamic.

This setup requires at least an intermittent internet connection.

User Configuration:

  • Select Dynamic Sunrise option (obviously)
  • Set a +/- offset in minutes from dynamic time
  • Have a setting for dynamic or static longitude/latitude. Dynamic uses the device’s low accuracy GPS location to get latitude and longitude.

Functionally

Background task

  1. Gets lat/long from GPS or set static lat/long
  2. Makes API call to https://sunrise-sunset.org/api to get
  3. Converts API time (UTC) to local time
  4. Applies User configured offset to alarm time
  5. Sets alarm time in the Android alarm subsystem

This task should probably run about 4 times a day in case the device is moving timezone/long/lat.

2 posts were merged into an existing topic: Before / after sunrise alarm

Moved to Before / after sunrise alarm topic.