wbreeze / ShipsClock

An iOS, SwiftUI clock for tracking watches on board a ship. Marks the day in periods of four hours.
https://wbreeze.github.io/ShipsClock
Apache License 2.0
2 stars 0 forks source link

Implement bell chimes when app does not have focus #2

Closed wbreeze closed 4 years ago

wbreeze commented 4 years ago

Closes #1

wbreeze commented 4 years ago

Effects the background bell playing by setting forty-eight notifications, at each half hour of the day, with the correct bell sound.

This won't be strictly accurate for time changing with change in longitude, or if the phone changes time zones while the app is in the background. As soon as the app regains the foreground, it cancels the notifications and begins its own accurate time keeping. Going to background again, the bell rings will come as accurately as the notifications.

It feels like a work-around compared with timing each notice following the next; however, it works.

Nicely, not setting a body or title in the notification content, no notifications show-up in the notification center. The sound plays and life goes on.