Reputation: 6081
I'm working on a fitness tracker app and want to update long-running Live Activity frequently — once per second.
But I also want to keep the battery usage low and don't want to calculate stats and everything when user won't see it.
I know I can see app's current Live Activities using Activity.activities
.
Is there are any way to tell if iPhone is not in user's pocket, its screen is on (with always on display or not) and it's really worth updating Live Activity?
Upvotes: 0
Views: 500
Reputation: 114
You can check SwiftUI’s isLuminanceReduced environment value to detect reduced luminance.
Upvotes: 0